saleguas / context_menu

💻 A Python library to create and deploy cross-platform native context menus. 💻
https://context-menu.readthedocs.io/en/latest/index.html
MIT License
469 stars 24 forks source link

Command_vars dont work correctly with spaces in filename #41

Open saalaus opened 7 months ago

saalaus commented 7 months ago

The script does not escape file paths with quotes, so it does not work properly if there are problems in the file path

cm = menus.ContextMenu("Converter", type=".mp4")
cm.add_items(
    [menus.ContextCommand("to mp3", "C:/ProgramData/chocolatey/bin/ffmpeg.exe -i ? test.mp3", command_vars=['FILENAME'])]
)
cm.compile()

For file path: "C:\Users\saala\Videos\Base Profile\test123.mp4"

Execute script: C:/ProgramData/chocolatey/bin/ffmpeg.exe -i C:\Users\saala\Videos\Base Profile\test123.mp4 test.mp3 ^ this dont work correctly

fhabermacher commented 1 month ago

Same issue here. Did you find any fix to this? I contemplate a workaround by changing the executed command in a way for it to first merge the split file-subnames into the correct filename, but that is an annoying way. (I'm running py 11 @ win 11)