diff --git a/webserver/Dockerfile b/webserver/Dockerfile index 4770742..565c9ea 100644 --- a/webserver/Dockerfile +++ b/webserver/Dockerfile @@ -191,6 +191,10 @@ RUN cd /rw/extensions/PageForms && patch -l -p0 < PF_AutoEdit.php.$MW_REL_BRANCH RUN cd /rw/extensions/PageForms && patch -l -p0 < PF_TemplateField.php.$MW_REL_BRANCH.patch RUN cd /rw/extensions/PageForms && patch -l -p0 < PF_FormPrinter.php.$MW_REL_BRANCH.patch +# Apply PageForms patch to preserve default filenames in upload window +# (prevents auto-filled destination filename from being overwritten by uploaded file's name) +RUN cd /rw/extensions/PageForms && patch -l -p0 < PF_upload.js.$MW_REL_BRANCH.patch + # Sphinx: Setup cron job RUN apt-get install -y cron \ && mv -f /rw/extensions/SphinxSearch/sphinx.cron /etc/cron.d/sphinxsearch-update \ diff --git a/webserver/html/ropewiki/LocalSettings.php b/webserver/html/ropewiki/LocalSettings.php index 9e98f33..cf26972 100644 --- a/webserver/html/ropewiki/LocalSettings.php +++ b/webserver/html/ropewiki/LocalSettings.php @@ -368,4 +368,4 @@ $isKnown = true; } return true; -}; \ No newline at end of file +}; diff --git a/webserver/html/ropewiki/extensions/PageForms/PF_upload.js.REL1_39.patch b/webserver/html/ropewiki/extensions/PageForms/PF_upload.js.REL1_39.patch new file mode 100644 index 0000000..ca84d9f --- /dev/null +++ b/webserver/html/ropewiki/extensions/PageForms/PF_upload.js.REL1_39.patch @@ -0,0 +1,35 @@ +--- libs/PF_upload.js.orig 2026-04-09 21:30:55.040234672 -0700 ++++ libs/PF_upload.js 2026-04-09 21:31:15.828382322 -0700 +@@ -33,6 +33,14 @@ + // Remove any previously flagged errors + $( '#mw-upload-permitted, #mw-upload-prohibited' ).removeClass(); + ++ // ROPEWIKI PATCH: Check if destination field already has a value ++ // If it does, preserve it instead of overwriting with the uploaded filename ++ var destField = $( '#wpDestFile' ); ++ if ( destField.length && destField.val() && destField.val().trim() !== '' ) { ++ // Destination filename already set, don't overwrite it ++ return; ++ } ++ + path = $( this ).val(); + // Find trailing part + slash = path.lastIndexOf( '/' ); +@@ -53,14 +61,14 @@ + // } + + // Output result +- if ( $( '#wpDestFile' ).length ) { ++ if ( destField.length ) { + // Call decodeURIComponent function to remove possible URL-encoded characters + // from the file name (T32390). Especially likely with upload-form-url. + // decodeURIComponent can throw an exception if input is invalid utf-8 + try { +- $( '#wpDestFile' ).val( decodeURIComponent( fname ) ); ++ destField.val( decodeURIComponent( fname ) ); + } catch ( err ) { +- $( '#wpDestFile' ).val( fname ); ++ destField.val( fname ); + } + //uploadWarning.checkNow( fname ); + }