Check string length to avoid crash for "tags:/" URL
Reviewed changes merged with upstream commit.
Differential Revision: https://phabricator.kde.org/D19371