[Home]WikiBugs/PreventBadURLs

UseModWiki | WikiBugs | RecentChanges | Preferences

Despite being an action for admins, this fix will help prevent some incoherent messages as "1001 has been deleted." for wrong URL, "https://www.usemod.org/cgi-bin/wiki.pl?action=delete" and others.

Possibly, as described, DoDeletePage? is not the only place where to apply. Others, too: DoHistory.

sub DoDeletePage {
  my ($id) = @_;

  return  if (!&ValidIdOrDie($id));
  print &GetHeader('', Ts('Delete %s', $id), '');
  return if (!&UserIsAdminOrError());
+  if (!-f &GetPageFile($id)) {
+    print T('Invalid URL or file does not exist --nothing done');
+    print &GetCommonFooter();
+    return;
+  }
  if ($ConfirmDel && !&GetParam('confirm', 0)) {
...
sub DoHistory {
  my ($id) = @_;
  my ($html, $canEdit, $row, $newText);

+ return  if (!&ValidIdOrDie($id)); 
  print &GetHeader('', Ts('History of %s', $id), '');
+  if (!-f &GetPageFile($id)) {
+    print T('Invalid URL or file does not exist --nothing done');
+    print &GetCommonFooter();
+    return;
+  }
  &OpenPage($id);
  &OpenDefaultText();
--JuanmaMP

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited November 6, 2023 8:30 pm by MarkusLude (diff)
Search: