mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 11:22:38 -04:00
Fix handling of absolute url in kiwix-serve.
We still need to change the html content to handle absolute url in zims. Issue has been introduced by commit 978dc47. Some code was not related to redirection but to absolute url. I have made a clean a bit too more aggressive. Fix #262
This commit is contained in:
parent
e4eafd7459
commit
c332c123fe
@ -806,8 +806,24 @@ static struct MHD_Response* handle_content(RequestContext* request)
|
||||
zim::Blob raw_content = entry.getBlob();
|
||||
content = string(raw_content.data(), raw_content.size());
|
||||
|
||||
/* Special rewrite URL in case of ZIM file use intern *asbolute* url like
|
||||
* /A/Kiwix */
|
||||
if (mimeType.find("text/html") != string::npos) {
|
||||
pthread_mutex_lock(®exLock);
|
||||
content = replaceRegex(content,
|
||||
"$1$2" + rootLocation + "/" + humanReadableBookId + "/$3/",
|
||||
"(href|src)(=[\"|\']{0,1})/([A-Z|\\-])/");
|
||||
content = replaceRegex(content,
|
||||
"$1$2" + rootLocation + "/" + humanReadableBookId + "/$3/",
|
||||
"(@import[ ]+)([\"|\']{0,1})/([A-Z|\\-])/");
|
||||
pthread_mutex_unlock(®exLock);
|
||||
introduceTaskbar(content, humanReadableBookId);
|
||||
} else if (mimeType.find("text/css") != string::npos) {
|
||||
pthread_mutex_lock(®exLock);
|
||||
content = replaceRegex(content,
|
||||
"$1$2" + rootLocation + "/" + humanReadableBookId + "/$3/",
|
||||
"(url|URL)(\\([\"|\']{0,1})/([A-Z|\\-])/");
|
||||
pthread_mutex_unlock(®exLock);
|
||||
}
|
||||
|
||||
bool deflated
|
||||
|
Loading…
x
Reference in New Issue
Block a user