From 68a136602473f4d60829cfb9c8e6afaa9aad165b Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 8 Apr 2024 11:59:31 +0100 Subject: [PATCH 1/5] Fix #589 --- thoth-export-server/src/xml/onix3_thoth.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/thoth-export-server/src/xml/onix3_thoth.rs b/thoth-export-server/src/xml/onix3_thoth.rs index aa68f0b2..0f718536 100644 --- a/thoth-export-server/src/xml/onix3_thoth.rs +++ b/thoth-export-server/src/xml/onix3_thoth.rs @@ -422,8 +422,13 @@ impl XmlElementBlock for Work { })?; write_element_block("CollateralDetail", w, |w| { if let Some(mut short_abstract) = self.short_abstract.clone() { - // Short description field may not exceed 350 characters - short_abstract.truncate(350); + // Short description field may not exceed 350 characters. + // Ensure that the string is truncated at a valid UTF-8 boundary + // by finding the byte index of the 350th character and then truncating + // the string at that index, to avoid creating invalid UTF-8 sequences. + if let Some((byte_index, _)) = short_abstract.char_indices().nth(350) { + short_abstract.truncate(byte_index); + } write_element_block("TextContent", w, |w| { // 02 Short description write_element_block("TextType", w, |w| { From 1dabb2d47f4767fb580eebaed1a66192be956e8b Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 8 Apr 2024 11:59:35 +0100 Subject: [PATCH 2/5] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a87f499..0f6e8e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + - [589](https://github.com/thoth-pub/thoth/issues/589) - Truncation of `short_abstract` in Thoth ONIX results in Invalid UTF-8 sequences ## [[0.12.0]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.0) - 2024-03-14 ### Removed From 86a0d3ad694cf5352dff5f8c5e9e675224468e68 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 8 Apr 2024 12:15:22 +0100 Subject: [PATCH 3/5] Bump v0.12.1 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 12 ++++++------ thoth-api-server/Cargo.toml | 6 +++--- thoth-api/Cargo.toml | 4 ++-- thoth-app-server/Cargo.toml | 2 +- thoth-app/Cargo.toml | 6 +++--- thoth-app/manifest.json | 2 +- thoth-client/Cargo.toml | 8 ++++---- thoth-errors/Cargo.toml | 2 +- thoth-export-server/Cargo.toml | 8 ++++---- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4501c0ed..1bf6eef1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3087,7 +3087,7 @@ dependencies = [ [[package]] name = "thoth" -version = "0.12.0" +version = "0.12.1" dependencies = [ "cargo-husky", "clap", @@ -3102,7 +3102,7 @@ dependencies = [ [[package]] name = "thoth-api" -version = "0.12.0" +version = "0.12.1" dependencies = [ "actix-web", "argon2rs", @@ -3131,7 +3131,7 @@ dependencies = [ [[package]] name = "thoth-api-server" -version = "0.12.0" +version = "0.12.1" dependencies = [ "actix-cors", "actix-identity", @@ -3147,7 +3147,7 @@ dependencies = [ [[package]] name = "thoth-app" -version = "0.12.0" +version = "0.12.1" dependencies = [ "anyhow", "chrono", @@ -3176,7 +3176,7 @@ dependencies = [ [[package]] name = "thoth-app-server" -version = "0.12.0" +version = "0.12.1" dependencies = [ "actix-cors", "actix-web", @@ -3186,7 +3186,7 @@ dependencies = [ [[package]] name = "thoth-client" -version = "0.12.0" +version = "0.12.1" dependencies = [ "chrono", "graphql_client", @@ -3202,7 +3202,7 @@ dependencies = [ [[package]] name = "thoth-errors" -version = "0.12.0" +version = "0.12.1" dependencies = [ "actix-web", "csv", @@ -3223,7 +3223,7 @@ dependencies = [ [[package]] name = "thoth-export-server" -version = "0.12.0" +version = "0.12.1" dependencies = [ "actix-cors", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 2395668b..20f65dd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" } members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"] [dependencies] -thoth-api = { version = "0.12.0", path = "thoth-api", features = ["backend"] } -thoth-api-server = { version = "0.12.0", path = "thoth-api-server" } -thoth-app-server = { version = "0.12.0", path = "thoth-app-server" } -thoth-errors = { version = "0.12.0", path = "thoth-errors" } -thoth-export-server = { version = "0.12.0", path = "thoth-export-server" } +thoth-api = { version = "=0.12.1", path = "thoth-api", features = ["backend"] } +thoth-api-server = { version = "=0.12.1", path = "thoth-api-server" } +thoth-app-server = { version = "=0.12.1", path = "thoth-app-server" } +thoth-errors = { version = "=0.12.1", path = "thoth-errors" } +thoth-export-server = { version = "=0.12.1", path = "thoth-export-server" } clap = { version = "4.4.7", features = ["cargo", "env"] } dialoguer = { version = "0.11.0", features = ["password"] } dotenv = "0.15.0" diff --git a/thoth-api-server/Cargo.toml b/thoth-api-server/Cargo.toml index e0263708..a748c3fa 100644 --- a/thoth-api-server/Cargo.toml +++ b/thoth-api-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api-server" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth" readme = "README.md" [dependencies] -thoth-api = { version = "0.12.0", path = "../thoth-api", features = ["backend"] } -thoth-errors = { version = "0.12.0", path = "../thoth-errors" } +thoth-api = { version = "0.12.1", path = "../thoth-api", features = ["backend"] } +thoth-errors = { version = "0.12.1", path = "../thoth-errors" } actix-web = "4.5.1" actix-cors = "0.7.0" actix-identity = "0.7.1" diff --git a/thoth-api/Cargo.toml b/thoth-api/Cargo.toml index 3a0aa922..7672caf8 100644 --- a/thoth-api/Cargo.toml +++ b/thoth-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" } backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web", "jsonwebtoken"] [dependencies] -thoth-errors = { version = "0.12.0", path = "../thoth-errors" } +thoth-errors = { version = "0.12.1", path = "../thoth-errors" } actix-web = { version = "4.5.1", optional = true } argon2rs = "0.2.5" isbn2 = "0.4.0" diff --git a/thoth-app-server/Cargo.toml b/thoth-app-server/Cargo.toml index 0595d346..00d6fd50 100644 --- a/thoth-app-server/Cargo.toml +++ b/thoth-app-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app-server" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" diff --git a/thoth-app/Cargo.toml b/thoth-app/Cargo.toml index 59a043ec..33eaf995 100644 --- a/thoth-app/Cargo.toml +++ b/thoth-app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -36,8 +36,8 @@ uuid = { version = "0.8.2", features = ["serde", "v4"] } # `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm # https://docs.rs/getrandom/latest/getrandom/#webassembly-support getrandom = { version = "0.2", features = ["js"] } -thoth-api = { version = "0.12.0", path = "../thoth-api" } -thoth-errors = { version = "0.12.0", path = "../thoth-errors" } +thoth-api = { version = "0.12.1", path = "../thoth-api" } +thoth-errors = { version = "0.12.1", path = "../thoth-errors" } [build-dependencies] dotenv = "0.15.0" diff --git a/thoth-app/manifest.json b/thoth-app/manifest.json index 0fcc79eb..b95de004 100644 --- a/thoth-app/manifest.json +++ b/thoth-app/manifest.json @@ -9,7 +9,7 @@ "start_url": "/?homescreen=1", "background_color": "#ffffff", "theme_color": "#ffdd57", - "version": "0.12.0", + "version": "0.12.1", "icons": [ { "src": "\/admin\/android-icon-36x36.png", diff --git a/thoth-client/Cargo.toml b/thoth-client/Cargo.toml index a1ff181f..22cb1970 100644 --- a/thoth-client/Cargo.toml +++ b/thoth-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-client" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -10,8 +10,8 @@ readme = "README.md" build = "build.rs" [dependencies] -thoth-api = {version = "0.12.0", path = "../thoth-api" } -thoth-errors = {version = "0.12.0", path = "../thoth-errors" } +thoth-api = {version = "0.12.1", path = "../thoth-api" } +thoth-errors = {version = "0.12.1", path = "../thoth-errors" } graphql_client = "0.13.0" chrono = { version = "0.4.31", features = ["serde"] } reqwest = { version = "0.11", features = ["json"] } @@ -22,4 +22,4 @@ serde_json = "1.0" uuid = { version = "0.8.2", features = ["serde"] } [build-dependencies] -thoth-api = { version = "0.12.0", path = "../thoth-api", features = ["backend"] } +thoth-api = { version = "0.12.1", path = "../thoth-api", features = ["backend"] } diff --git a/thoth-errors/Cargo.toml b/thoth-errors/Cargo.toml index d97265a6..e12442e6 100644 --- a/thoth-errors/Cargo.toml +++ b/thoth-errors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-errors" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index 53158a6c..1802df27 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-export-server" -version = "0.12.0" +version = "0.12.1" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -10,9 +10,9 @@ readme = "README.md" build = "build.rs" [dependencies] -thoth-api = { version = "0.12.0", path = "../thoth-api" } -thoth-errors = { version = "0.12.0", path = "../thoth-errors" } -thoth-client = { version = "0.12.0", path = "../thoth-client" } +thoth-api = { version = "0.12.1", path = "../thoth-api" } +thoth-errors = { version = "0.12.1", path = "../thoth-errors" } +thoth-client = { version = "0.12.1", path = "../thoth-client" } actix-web = "4.5.1" actix-cors = "0.7.0" cc_license = "0.1.0" From 696e141d56cc5aaccb38bc7dbfcc0d408bda673b Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 8 Apr 2024 12:15:52 +0100 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f6e8e1a..5ff3f95e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [[0.12.1]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.1) - 2024-04-8 ### Fixed - [589](https://github.com/thoth-pub/thoth/issues/589) - Truncation of `short_abstract` in Thoth ONIX results in Invalid UTF-8 sequences From a0806588d65110e3bde914a9387dd180c8e74f6c Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 8 Apr 2024 12:18:06 +0100 Subject: [PATCH 5/5] Patch h2 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1bf6eef1..6293da86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1544,9 +1544,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv",