mardelle created this revision. mardelle added a reviewer: Frameworks. mardelle added a project: Frameworks. Herald added a subscriber: kde-frameworks-devel. mardelle requested review of this revision.
REVISION SUMMARY There are 2 different issues in current code regarding maximum filename length: 1- We use FILENAME_MAX which is defined as 4096, while most filesystems have a max length of 256. Replacing FILENAME_MAX with NAME_MAX fixes this first problem (could not test on Windows if it works) 2- We are calculating the maximum length on the UTF-8 string, then encoding to percent encoding. This can result in longer strings since single characters will be replaced by a percent string. So in some situations, we end up with a string longer than allowed. Doing the percent encoding before length calculation fixes the problem. This fixes the follwing bug: https://bugs.kde.org/show_bug.cgi?id=412519 TEST PLAN Bug is fixed with the changes REPOSITORY R244 KCoreAddons REVISION DETAIL https://phabricator.kde.org/D24489 AFFECTED FILES src/lib/io/kautosavefile.cpp To: mardelle, #frameworks Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns