aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Nikolov <ggeorgi60@gmail.com>2025-01-26 16:07:04 +0200
committerGeorgi Nikolov <ggeorgi60@gmail.com>2025-01-26 16:07:04 +0200
commita33e61236a8645dfa1a5fe6e5436eca574351024 (patch)
tree567c0810f763a775611a7fbbe7edeebdbea3dfe6
parent0874c30ff6443f6b40f4ef96739be330d9d4940a (diff)
downloadnowayforward_human-a33e61236a8645dfa1a5fe6e5436eca574351024.tar
nowayforward_human-a33e61236a8645dfa1a5fe6e5436eca574351024.tar.gz
nowayforward_human-a33e61236a8645dfa1a5fe6e5436eca574351024.zip
Fixed the absolute links in the page being broken when exiting the page
-rw-r--r--controllers/archive.php12
1 files changed, 2 insertions, 10 deletions
diff --git a/controllers/archive.php b/controllers/archive.php
index 8d0151e..0d21a1e 100644
--- a/controllers/archive.php
+++ b/controllers/archive.php
@@ -297,9 +297,8 @@ class DownloadPage {
$link = $tag->getAttribute($attribute);
// Make a request to the db and check if any URLs like the 'link'
// exist in it and are presently donwloaded
- //$link_url = $this->resolveUrl($link);
+ $link = $this->resolveUrl($link, $this->page_url);
$page_url_pattern = $this->getCorrectLinkPattern($link);
- // TODO: The link should depend on whether there is a domain in the front or not
$correct_results = Database\Webpage::getArchivePathsByPattern('%' . $page_url_pattern . '%');
if (count($correct_results) != 0) {
@@ -309,18 +308,11 @@ class DownloadPage {
} else {
// If there are no pages that are like that url point to the landing page of the site
// that says that this page was not yet archived
- $tag->setAttribute($attribute, "/archive/?url=" . $this->baseToFullUrlForGet($this->page_url, $link));
+ $tag->setAttribute($attribute, "/archive/?url=" . $link);
}
}
}
- function baseToFullUrlForGet($url, $base) : string {
- $replaced = rtrim($url, '/') . '/' . ltrim($base, '/');
- $replaced = str_replace('/', '%2F', $replaced);
- $replaced = str_replace(':', '%3A', $replaced);
- return $replaced;
- }
-
function isResourceAccessible($url) : bool {
$curl_func = curl_init($url);
curl_setopt($curl_func, CURLOPT_NOBODY, true); // Gives only the headers