Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ polygon-ops = ["dep:clipper2", "dep:earcutr"]
zip = { version = "8", default-features = false, features = [
"deflate-flate2-zlib-rs",
] }
quick-xml = "0.41.0"
quick-xml = "0.42.0"
thiserror = "2.0"
# Cryptographic dependencies for SecureContent decryption (optional, enabled via 'crypto' feature)
rsa = { version = "0.9", optional = true }
Expand Down
10 changes: 5 additions & 5 deletions src/opc/content_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(super) fn validate_keystore_content_type<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Override") {
Expand All @@ -41,9 +41,9 @@ pub(super) fn validate_keystore_content_type<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -71,9 +71,9 @@ pub(super) fn validate_keystore_content_type<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down
32 changes: 16 additions & 16 deletions src/opc/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn validate_content_types<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Default") {
Expand All @@ -107,9 +107,9 @@ fn validate_content_types<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -171,9 +171,9 @@ fn validate_content_types<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -354,7 +354,7 @@ fn validate_all_relationships<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
Expand All @@ -364,9 +364,9 @@ fn validate_all_relationships<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -699,7 +699,7 @@ fn discover_model_path<R: Read + std::io::Seek>(package: &mut Package<R>) -> Res
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
Expand All @@ -708,9 +708,9 @@ fn discover_model_path<R: Read + std::io::Seek>(package: &mut Package<R>) -> Res

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -848,7 +848,7 @@ fn get_content_type<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

// Check for Override elements (specific path matches)
Expand All @@ -858,9 +858,9 @@ fn get_content_type<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand All @@ -886,9 +886,9 @@ fn get_content_type<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down
18 changes: 9 additions & 9 deletions src/opc/relationships.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) fn discover_keystore_path<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
Expand All @@ -29,9 +29,9 @@ pub(super) fn discover_keystore_path<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -130,7 +130,7 @@ pub(super) fn has_relationship_to_target<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
Expand All @@ -139,9 +139,9 @@ pub(super) fn has_relationship_to_target<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -190,7 +190,7 @@ pub(super) fn validate_keystore_relationship<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
Expand All @@ -199,9 +199,9 @@ pub(super) fn validate_keystore_relationship<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down
28 changes: 14 additions & 14 deletions src/opc/thumbnail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn get_content_type<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

// Check for Override elements (specific path matches)
Expand All @@ -40,9 +40,9 @@ fn get_content_type<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand All @@ -68,9 +68,9 @@ fn get_content_type<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -122,7 +122,7 @@ pub(super) fn get_thumbnail_metadata<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
Expand All @@ -131,9 +131,9 @@ pub(super) fn get_thumbnail_metadata<R: Read + std::io::Seek>(

for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

match key {
Expand Down Expand Up @@ -275,15 +275,15 @@ pub(super) fn validate_no_model_level_thumbnails<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if key == "Type" && value == THUMBNAIL_REL_TYPE {
Expand Down Expand Up @@ -324,15 +324,15 @@ pub(super) fn validate_no_model_level_thumbnails<R: Read + std::io::Seek>(
match reader.read_event_into(&mut buf) {
Ok(Event::Empty(ref e)) | Ok(Event::Start(ref e)) => {
let name = e.name();
let name_str = std::str::from_utf8(name.as_ref())
let name_str = std::str::from_utf8(name.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if name_str.ends_with("Relationship") {
for attr in e.attributes() {
let attr = attr?;
let key = std::str::from_utf8(attr.key.as_ref())
let key = std::str::from_utf8(attr.key.as_ref().as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;
let value = std::str::from_utf8(&attr.value)
let value = std::str::from_utf8(attr.value.as_bytes())
.map_err(|e| Error::InvalidXml(e.to_string()))?;

if key == "Type" && value == THUMBNAIL_REL_TYPE {
Expand Down
Loading
Loading