1 commit 167f7fc08fc8f6aedf864f3fc3c77b4c96a86f84
2 Author: Marcin Banasiak <megabajt@pld-linux.org>
3 Date: Sat May 30 12:13:31 2009 +0200
5 Decode strings that may be urlencoded before displaying.
7 diff --git a/vfile/fetch.c b/vfile/fetch.c
8 index 0a4ee5a..88d98dd 100644
11 @@ -828,6 +828,39 @@ const char *vf_url_slim_s(const char *url, int maxl)
12 return vf_url_slim(buf, sizeof(buf), url, maxl > 50 ? maxl : 60);
15 +char *vf_url_unescape(const char *url)
17 + char *unescaped = NULL;
23 + unescaped = n_malloc(strlen(url) + 1);
28 + if (*url == '%' && isxdigit(url[1]) && isxdigit(url[2])) {
35 + ch = (char)strtol(str, NULL, 16);
40 + unescaped[unesclen++] = ch;
44 + unescaped[unesclen] = '\0';
49 int vf_find_external_command(char *cmdpath, int size, const char *cmd,
51 diff --git a/vfile/libvfile.sym b/vfile/libvfile.sym
52 index c283fcb..d96d3a5 100644
53 --- a/vfile/libvfile.sym
54 +++ b/vfile/libvfile.sym
55 @@ -41,6 +41,7 @@ vf_url_proto
63 diff --git a/vfile/vfetch.c b/vfile/vfetch.c
64 index 7f23244..cb46dd1 100644
67 @@ -219,8 +219,8 @@ int vfile__vf_fetch(const char *url, const char *dest_dir, unsigned flags,
68 struct vflock *vflock = NULL;
69 struct vf_request *req = NULL;
70 char destpath[PATH_MAX];
71 + char *url_unescaped = NULL;
75 if (*vfile_verbose <= 0)
76 flags |= VF_FETCH_NOLABEL|VF_FETCH_NOPROGRESS;
77 @@ -239,11 +239,15 @@ int vfile__vf_fetch(const char *url, const char *dest_dir, unsigned flags,
79 if ((mod = select_vf_module(url)) == NULL) { /* no internal module found */
80 if ((flags & VF_FETCH_NOLABEL) == 0) {
81 + url_unescaped = vf_url_unescape(url);
84 vf_loginfo(_("Retrieving %s::%s...\n"), urlabel,
86 + n_basenam(url_unescaped));
88 - vf_loginfo(_("Retrieving %s...\n"), PR_URL(url));
89 + vf_loginfo(_("Retrieving %s...\n"), PR_URL(url_unescaped));
91 + free(url_unescaped);
94 rc = vf_fetch_ext(url, destdir);
95 @@ -298,11 +302,15 @@ int vfile__vf_fetch(const char *url, const char *dest_dir, unsigned flags,
98 if ((flags & VF_FETCH_NOLABEL) == 0) {
99 + url_unescaped = vf_url_unescape(req->url);
102 vf_loginfo(_("Retrieving %s::%s...\n"), urlabel,
103 - n_basenam(req->url));
104 + n_basenam(url_unescaped));
106 - vf_loginfo(_("Retrieving %s...\n"), PR_URL(req->url));
107 + vf_loginfo(_("Retrieving %s...\n"), PR_URL(url_unescaped));
109 + free(url_unescaped);
112 if ((rc = do_vfile_req(REQTYPE_FETCH, mod, req, flags)) == 0) {
113 diff --git a/vfile/vfile.h b/vfile/vfile.h
114 index 0125a68..13501eb 100644
117 @@ -182,6 +182,7 @@ const char *vf_url_hidepasswd_s(const char *url);
118 const char *vf_url_slim(char *buf, int size, const char *url, int maxl);
119 const char *vf_url_slim_s(const char *url, int maxl);
121 +char *vf_url_unescape(const char *url);
123 int vf_valid_path(const char *path);
124 int vf_mkdir(const char *path);