Bug 410551

Summary: Relative links incorrectly captured
Product: [Applications] tellico Reporter: Pol del Aguila Pla <polsocjo>
Component: generalAssignee: Robby Stephenson <robby>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.1.2   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed In: 3.2.2
Sentry Crash Report:

Description Pol del Aguila Pla 2019-08-03 20:44:37 UTC
SUMMARY
URL-type fields with the property "relative" set to "true" are incorrectly captured from the file manager and preceded with an erroneous ../.


STEPS TO REPRODUCE
1. Create an empty "test.tc" database of type "Book collection"
2. Create a directory "test_folder" in the same location and create a file "test.txt" inside it 
3. Use Collection -> Collection Fields -> New to add a Type URL field with name URL
4. Use Set properties to set the property "relative" to "true".
5. Use New to add a new element in the library, name it "Bla"
6. Set the URL property with the file manager to the file test.txt inside the test_folder directory and save the entry and database

OBSERVED RESULT
The URL field of the entry Bla is set to ../test_folder/test.txt. Every time one opens and closes Tellico, a new ../ prefix is added, i.e., ../../test_folder/test.txt, etc.

EXPECTED RESULT
The URL field of the entry Bla is set to test_folder/test.txt and clicking on it launches the system-configured application for .txt files.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux Mint 19.1 Tessa, KDE Frameworks 5.44.0 (The xcb windowing system)
Qt Version: 5.9.5 (built against 5.9.5)

ADDITIONAL INFORMATION
Comment 1 Robby Stephenson 2019-08-05 02:16:25 UTC
Git commit d32857b7cb8b03b6f8c89dcbdc41e557e298f29d by Robby Stephenson.
Committed on 05/08/2019 at 02:13.
Pushed by rstephenson into branch '3.2'.

Remove file name in QDir c'tor when calculating relative links

Since the data file name is used as the base url, the QDir should have a
directory used as the path instead.
FIXED-IN: 3.2.2

M  +4    -0    ChangeLog
M  +3    -3    src/gui/urlfieldlogic.cpp
M  +7    -0    src/tests/fieldtest.cpp

https://commits.kde.org/tellico/d32857b7cb8b03b6f8c89dcbdc41e557e298f29d