Skip to content

Percent-encode export preset filenames - #1938

Merged
ddennedy merged 1 commit into
mltframework:masterfrom
WMikhail:fix/export-preset-name
Oct 16, 2026
Merged

ddennedy merged 1 commit into
mltframework:masterfrom
WMikhail:fix/export-preset-name

Conversation

@WMikhail

@WMikhail WMikhail commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Custom export preset names are used as filenames, so a name such as H264/1080p can fail to save.

Percent-encode the filename with QUrl and decode it for display. Slash and backslash are accepted without a warning. Keep the stored filename in the model for loading and deletion, preserve category grouping, and use the readable name in the delete confirmation. Recognize unencoded legacy filenames using the same round-trip check as filter presets.

Fixes #1719.

Validation:

  • Built and passed the Qt dialog regression test for plain names, slash, backslash, literal percent escapes, spaces, categories, and Unicode; each case writes, reopens, and removes its preset file.
  • Confirmed the same test fails in six cases on the unmodified upstream dialog.
  • Passed a separate Qt check compiling the custom-preset listing code and delete handler extracted from EncodeDock, including legacy filenames.
  • Passed clang-format 14.0.6 and git diff --check.

Full Shotcut build and manual application checks have not been run.

@WMikhail
WMikhail force-pushed the fix/export-preset-name branch from d026fed to feede93 Compare October 15, 2026 07:52
@bmatherly

Copy link
Copy Markdown
Member

The message box and rejection adds friction to the user. How would you feel about performing a substitution instead?

For example:

  • Replace "/" with "%2F"
  • Replace "" with "%5C"

An easy way would be to use https://doc.qt.io/qt-6/qurl.html#toPercentEncoding to create the folder name, and then use https://doc.qt.io/qt-6/qurl.html#fromPercentEncoding to get the original name back.

@WMikhail
WMikhail force-pushed the fix/export-preset-name branch from feede93 to 21731b8 Compare October 15, 2026 14:55
@WMikhail
WMikhail force-pushed the fix/export-preset-name branch from 21731b8 to 29fe012 Compare October 15, 2026 15:33
@WMikhail WMikhail changed the title Reject path separators in export preset names Percent-encode export preset filenames Oct 15, 2026
@bmatherly

Copy link
Copy Markdown
Member

Wow! That was fast. Did you also test that this change will continue to work with legacy names? For example, I expect this change will convert "1080 vertical" to "1080%20vertical". If the user has a folder called "1080 vertical", will it still be found after this change? Maybe we want to pass a few exceptions to the encoding function (like space, underscore, and parenthesis) so the folder names are still mostly readable. What do you think?

@ddennedy

Copy link
Copy Markdown
Member

Maybe we want to pass a few exceptions to the encoding function

QmlFilter::savePreset() already does percent-encoding, but it does not make exceptions. Unencoded file names will generally still load fine. However, I see in QmlFilter::loadPresets() a quirk 45c1bd0:

        if (s == QUrl::toPercentEncoding(QUrl::fromPercentEncoding(s.toUtf8())))
            m_presets << QUrl::fromPercentEncoding(s.toUtf8());
        else
            m_presets << s;

The commit message says "fix loading old preset with '%' in the name."

@WMikhail

Copy link
Copy Markdown
Contributor Author

Yes, I checked compatibility with legacy filenames containing spaces, %, Unicode, and category separators.

Existing presets retain their original filename in the model for loading and deletion; decoding only affects the displayed name. The patch already includes the same round-trip check used in QmlFilter::loadPresets().

I suggest keeping the encoding consistent with filter presets. Spaces and parentheses are encoded on disk and displayed normally in the UI. Underscores already remain unescaped.

Validation used the actual dialog and a separate Qt harness compiling the custom-preset listing code and delete handler extracted from EncodeDock. The checks passed for new encoded names and legacy filenames. Linux build and clang-format CI also passed.

@ddennedy ddennedy added this to the v26.next milestone Oct 16, 2026
@ddennedy
ddennedy merged commit 2aba367 into mltframework:master Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I can't save an export profile with “/“ in name

3 participants