comparison data/fileio/FileSource.cpp @ 336:5cd7f6d10d47

* Fix mishandling of encoded urls
author Chris Cannam
date Thu, 15 Nov 2007 13:19:25 +0000
parents 1d656dcda8ef
children 4175a4930186 6f6ab834449d
comparison
equal deleted inserted replaced
334:aa8dbac62024 336:5cd7f6d10d47
75 fileOrUrl.contains("--"))) { // for IDNA 75 fileOrUrl.contains("--"))) { // for IDNA
76 76
77 waitForStatus(); 77 waitForStatus();
78 78
79 if (!isAvailable()) { 79 if (!isAvailable()) {
80
80 // The URL was created on the assumption that the string 81 // The URL was created on the assumption that the string
81 // was human-readable. Let's try again, this time 82 // was human-readable. Let's try again, this time
82 // assuming it was already encoded. 83 // assuming it was already encoded.
83 std::cerr << "FileSource::FileSource: Failed to retrieve URL \"" 84 std::cerr << "FileSource::FileSource: Failed to retrieve URL \""
84 << fileOrUrl.toStdString() 85 << fileOrUrl.toStdString()
85 << "\" as human-readable URL; " 86 << "\" as human-readable URL; "
86 << "trying again treating it as encoded URL" 87 << "trying again treating it as encoded URL"
87 << std::endl; 88 << std::endl;
89
90 // even though our cache file doesn't exist (because the
91 // resource was 404), we still need to ensure we're no
92 // longer associating a filename with this url in the
93 // refcount map -- or createCacheFile will think we've
94 // already done all the work and no request will be sent
95 deleteCacheFile();
96
88 m_url.setEncodedUrl(fileOrUrl.toAscii()); 97 m_url.setEncodedUrl(fileOrUrl.toAscii());
98
99 m_ok = false;
100 m_done = false;
101 m_lastStatus = 0;
89 init(showProgress); 102 init(showProgress);
90 } 103 }
91 } 104 }
92 105
93 if (!isRemote()) { 106 if (!isRemote()) {