Truncate long filname before creating a link
ClosedPublic

Authored by chinmoyr on May 12 2019, 1:51 PM.

Details

Summary

URL of a website can exceed 255 characters. Consequently we cannot create a link to such URL.
In such cases try to truncate the filename to 255 characters.

BUG: 342247

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chinmoyr created this revision.May 12 2019, 1:51 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 12 2019, 1:51 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
chinmoyr requested review of this revision.May 12 2019, 1:51 PM
dfaure accepted this revision.May 12 2019, 6:59 PM
This revision is now accepted and ready to land.May 12 2019, 6:59 PM
ngraham accepted this revision.May 13 2019, 6:03 PM
This revision was automatically updated to reflect the committed changes.
bruns added a subscriber: bruns.May 14 2019, 2:14 PM

This has several issues:

The first issue is solved by the use of NAME_MAX (the code doesn't actually hardcode 255), but indeed those are bytes, so this has to use QFile::encodeName() (to get to QByteArray), truncate, then QFile::decodeName() (to get back to QString). But what if this cuts in the middle of a utf-8 sequence....