[zypp-commit] r11720 - in /trunk/libzypp/zypp: media/MediaISO.cc url/UrlUtils.h
Author: jkupec Date: Wed Nov 19 15:37:37 2008 New Revision: 11720 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11720&view=rev Log: - encode user-supplied URL strings before using them in the Url object (bnc #446395) Modified: trunk/libzypp/zypp/media/MediaISO.cc trunk/libzypp/zypp/url/UrlUtils.h Modified: trunk/libzypp/zypp/media/MediaISO.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaISO.cc?rev=11720&r1=11719&r2=11720&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaISO.cc (original) +++ trunk/libzypp/zypp/media/MediaISO.cc Wed Nov 19 15:37:37 2008 @@ -69,16 +69,18 @@ zypp::Url src; try { + // this percent-decodes the query parameter, it must be later encoded + // again before used in a Url object arg = _url.getQueryParam("url"); if( arg.empty() && _isofile.dirname().absolute()) { src = std::string("dir:///"); - src.setPathName(_isofile.dirname().asString()); + src.setPathName(url::encode(_isofile.dirname().asString(), URL_SAFE_CHARS)); _isofile = _isofile.basename(); } else { - src = arg; + src = url::encode(arg, URL_SAFE_CHARS); } } catch(const zypp::url::UrlException &e) @@ -214,7 +216,7 @@ ZYPP_THROW(MediaNotSupportedException(_url)); } - //! \todo make this thread-safe - another thread might pick up the same device + //! \todo make this thread-safe - another thread might pick up the same device string loopdev = findUnusedLoopDevice(); // (bnc #428009) MediaSourceRef media( new MediaSource("iso", loopdev)); Modified: trunk/libzypp/zypp/url/UrlUtils.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/url/UrlUtils.h?rev=11720&r1=11719&r2=11720&view=diff ============================================================================== --- trunk/libzypp/zypp/url/UrlUtils.h (original) +++ trunk/libzypp/zypp/url/UrlUtils.h Wed Nov 19 15:37:37 2008 @@ -18,6 +18,8 @@ #include <vector> #include <map> +/** Characters that are safe for URL without percent-encoding. */ +#define URL_SAFE_CHARS ":/?#[]@!$&'()*+,;=" ////////////////////////////////////////////////////////////////////// namespace zypp -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
jkupec@svn.opensuse.org