-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support loading images from urls without extensions #163
Conversation
``` | ||
RUST_LOG=vl_convert | ||
RUST_LOG=info | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way logging info for usvg is displayed as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update to cargo-bundle-license crate
return None; | ||
}; | ||
get_text_width_from_path(node) | ||
get_text_width_from_path(text.convert(font_db, Default::default())?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clippy fix
@@ -29,21 +29,18 @@ pub type ImageHrefStringResolverFn = Box<dyn Fn(&str, &Options) -> Option<ImageK | |||
pub fn custom_string_resolver() -> ImageHrefStringResolverFn { | |||
let default_string_resolver = ImageHrefResolver::default_string_resolver(); | |||
Box::new(move |href: &str, opts: &Options| { | |||
info!("Resolving image: {href}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added logging
Very clever solution! Really cool to read your code🙌 |
Closes #162
The issue was that this tile provider serves images in jpg format, but the URLs do not include a file extension (e.g. https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/5/14/17) and usvg uses the file extension to infer the image type. This PR adds logic to infer the image type from the
Content-Type
header and use that to build a file extension that usvg is happy with.cc @binste