Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise flag on malformed URLs #128

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/src/Core/parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function analyzePage( &$modifiedLinks = [], $webRequest = false, &$editEr
) {
//Populate URLs to submit for archiving.
if( $i == 1 ) {
$toArchive["$tid:$id"] = $link['url'];
if( !isset( $link['malformed_url'] ) ) $toArchive["$tid:$id"] = $link['url'];
} else {
//If it archived, then tally the success, otherwise, note it.
if( $archiveResponse["$tid:$id"] === true ) {
Expand All @@ -331,7 +331,7 @@ public function analyzePage( &$modifiedLinks = [], $webRequest = false, &$editEr
) {
//Populate URLs to submit for archiving.
if( $i == 1 ) {
$toArchive[$tid] = $link['url'];
if( !isset( $link['malformed_url'] ) ) $toArchive[$tid] = $link['url'];
} else {
//If it archived, then tally the success, otherwise, note it.
if( $archiveResponse[$tid] === true ) {
Expand Down Expand Up @@ -2390,6 +2390,10 @@ public function getLinkDetails( $linkString, $remainder ) {
unset( $returnArray['original_url'] );
}

if( empty( strtolower( parse_url( $this->deadCheck->sanitizeURL( $returnArray['url'] ), PHP_URL_SCHEME ) ) ) ) {
$returnArray['malformed_url'] = true;
}

if( isset( $returnArray['archive_template'] ) ) {
if( isset( $returnArray['archive_template']['parameters']['__FORMAT__'] ) ) {
$returnArray['archive_template']['format'] =
Expand Down
Loading