Fix sharing files with spaces or quotes in names via Telegram
ClosedPublic

Authored by mikhailru on Feb 8 2019, 2:55 PM.

Details

Summary

At present, when one tries to share files with
certain names via Telegram using Dolphin's share menu,
Dolphin crashes (names contain unbalanced quotes) or a wrong
name is passed to Telegram (names with spaces). The root cause
is KShell::splitArgs returning empty QStringList or doing
wrong splits for the above classes of names. This patch
postpones the substitution of "%u" with the actual filename
until splitting is done, thus avoiding undesired behavior.

Test Plan
  1. Create test files:

$ echo test | tee test\ .txt | tee test\'.txt > test\".txt

  1. Start Dolphin and share the files via Telegram.
  1. No errors and crashes should occur in the process.

Diff Detail

Repository
R495 Purpose Library
Branch
telegram-sharing-fix (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8575
Build 8593: arc lint + arc unit
mikhailru created this revision.Feb 8 2019, 2:55 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 8 2019, 2:55 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mikhailru requested review of this revision.Feb 8 2019, 2:55 PM
apol added a comment.Feb 18 2019, 4:42 PM

Should they really be joined? It seems like this will fail with more than one url.

I'd suggest changing arrayToList to provide quoted urls.

mikhailru updated this revision to Diff 52123.EditedFeb 19 2019, 11:36 PM

@apol, thanks for a nice suggestion! I somehow missed KShell::quoteArg. :)

apol accepted this revision.Feb 20 2019, 5:00 PM

Looks much better :D

Can you land the patch?

This revision is now accepted and ready to land.Feb 20 2019, 5:00 PM
mikhailru added a comment.EditedFeb 20 2019, 5:58 PM
In D18853#416211, @apol wrote:

Looks much better :D

Can you land the patch?

I'm afraid I can't. Actually this is my first KDE patch that has made it this far. :)

apol added a comment.Feb 21 2019, 7:59 PM

Cool! :D welcome to KDE!

This revision was automatically updated to reflect the committed changes.