[librsvg] image.rs: use Href::without_fragment()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] image.rs: use Href::without_fragment()
- Date: Thu, 29 Nov 2018 18:06:55 +0000 (UTC)
commit 28d867ece20d3520f8c2da1ed851461fa8a9ed5c
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Nov 29 11:33:01 2018 -0600
image.rs: use Href::without_fragment()
This will get cleaned up later, when we make Href::PlainUri() store an
AllowedUrl directly instead of a string.
rsvg_internals/src/image.rs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 0eaa6ece..cfe2079c 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -6,6 +6,7 @@ use allowed_url::AllowedUrl;
use aspect_ratio::AspectRatio;
use attributes::Attribute;
use bbox::BoundingBox;
+use defs::Href;
use drawing_ctx::DrawingCtx;
use error::{NodeError, RenderingError};
use float_eq_cairo::ApproxEqCairo;
@@ -73,7 +74,15 @@ impl NodeTrait for NodeImage {
Attribute::XlinkHref | Attribute::Path => {
// FIXME: use better errors here; these should be loading errors
- let aurl = AllowedUrl::from_href(value, handle::get_base_url(handle).as_ref())
+ let href = Href::without_fragment(value)
+ .map_err(|_| NodeError::value_error(attr, "fragment not allowed here"))?;
+
+ let url = match href {
+ Href::PlainUri(u) => u,
+ _ => unreachable!(),
+ };
+
+ let aurl = AllowedUrl::from_href(&url, handle::get_base_url(handle).as_ref())
.map_err(|_| NodeError::value_error(attr, "invalid URL"))?;
*self.surface.borrow_mut() = Some(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]