mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-26 13:07:49 -04:00
EntryToFile and the preview helpers stripped file:// without percent-decoding, so history entries whose paths contain non-ASCII characters stat'ed a literal %E5... path and copyEntry failed with "file not found". CopyFile additionally hard-failed any file larger than MaxEntrySize (5MB default) right after stat, so even decoded entries for bigger files could never be restored to the clipboard. Decode the path in EntryToFile, uriListPreview and tryReadImageFromURI. In CopyFile only read file content when it fits the size cap; oversized files still get offered as uri-list / gnome-copied-files / plain path, and the stored entry keeps the file URI instead of an empty body. Keep encode and decode symmetric: every URI this service stores or offers now goes through encodeFileURI (percent-encoded) and every read path decodes exactly once through pathFromFileURI, so a literal %20 in a file name survives the round trip. Regression tests cover space / literal %20 / # / CJK / oversized names across EntryToFile, uriListPreview, the image probe and handleCopyEntry.