mirror of
https://github.com/andwati/kget-capture.git
synced 2026-10-18 03:02:56 +00:00
Fix right-click download landing in home folder with wrong filename
Route context-menu captures through chrome.downloads so they resolve Chrome's real filename (Content-Disposition, extension, etc.) via the same onDeterminingFilename path auto-capture already uses, and harden the native host against the bare-directory destDir KGet was misparsing as a filename.
This commit is contained in:
@@ -49,7 +49,12 @@ def add_transfer(url, filename):
|
||||
# sidesteps KGet's own filename guess, which is derived purely from the
|
||||
# URL path and gets it wrong for opaque/signed URLs.
|
||||
dest_dir = default_download_dir()
|
||||
dest = os.path.join(dest_dir, filename) if filename else dest_dir
|
||||
# A bare directory path with no trailing slash (e.g. "/home/ian/Downloads")
|
||||
# gets misparsed by KGet's addTransfer as dir="/home/ian" + filename=
|
||||
# "Downloads" -- the same split it applies to a real dir/filename path --
|
||||
# landing the transfer in the parent directory instead. A trailing slash
|
||||
# keeps it unambiguous when we don't have a real filename to append.
|
||||
dest = os.path.join(dest_dir, filename) if filename else dest_dir.rstrip("/") + "/"
|
||||
cmd = [
|
||||
"dbus-send",
|
||||
"--print-reply",
|
||||
|
||||
Reference in New Issue
Block a user