Bug 472778 - Relative file URL generating incorrectly
Summary: Relative file URL generating incorrectly
Status: RESOLVED FIXED
Alias: None
Product: tellico
Classification: Applications
Component: general (show other bugs)
Version: 3.5.1
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Robby Stephenson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-29 16:48 UTC by Michael Young
Modified: 2023-09-23 02:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 3.5.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Young 2023-07-29 16:48:05 UTC
SUMMARY
After creating a new URL field with relative set to true, any URLs which may be added end up not working when moving the directory to a different location. The link will change and be mostly correct, however it will remove the folder which the Tellico file is contained within from the path which makes it not work.

STEPS TO REPRODUCE
1. Create a folder named "Test".
2. Place some kind of file inside of the "Test" folder, such as an image. Name it "Testfile".
3. Open Tellico and create a new custom collection. Save it into the "Test" folder under the name "TestCollection".
4. In this collection, create a URL field named "URL" and set property "relative" to "true".
5. Create a new entry titled "Test", and link the URL field to the "Testfile" file in the same folder.
6. Now that the URL is linking to the file correctly, save and exit Tellico.
7. Exit the "Test" folder and create a new folder within the same location. Title the new folder "MoveTestHere".
8. Move the "Test" folder into the "MoveTestHere" folder and open the Tellico file to view the URL.

OBSERVED RESULT
The URL which was set to relative is now altered to fit the change in location, but the "Test" folder which the files are contained within will be excluded from the path, and the URL will no longer function due to this. e.g. The URL which once pointed to "file:///home/*user*/Test/Testfile.png" now points to "file:///home/*user*/MoveTestHere/Testfile.png". 

(Moving just the files without the "Test" folder to "MoveTestHere" doesn't help either as it then will just exclude "MoveTestHere" from the path instead).

EXPECTED RESULT
The URL which is set to relative should now have been altered to fit the change in location, and should function as previously. e.g. The URL which once pointed to "file:///home/*user*/Test/Testfile.png" should now point to "file:///home/*user*/MoveTestHere/Test/Testfile.png".

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro KDE
(available in About System)
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Comment 1 Robby Stephenson 2023-09-23 02:08:11 UTC
Git commit 2e2b73fbff33e0323cc94e33e02fb8409a1c22c7 by Robby Stephenson.
Committed on 23/09/2023 at 04:08.
Pushed by rstephenson into branch 'master'.

Use same relative url logic when writing XML output
FIXED-IN: 3.5.2

M  +0    -1    src/gui/CMakeLists.txt
M  +1    -1    src/gui/urlfieldwidget.h
M  +1    -2    src/tests/CMakeLists.txt
M  +1    -1    src/tests/fieldtest.cpp
M  +1    -0    src/tests/tellicoreadtest.cpp
M  +7    -4    src/translators/tellicoxmlexporter.cpp
M  +1    -0    src/utils/CMakeLists.txt
R  +0    -0    src/utils/urlfieldlogic.cpp [from: src/gui/urlfieldlogic.cpp - 100% similarity]
R  +0    -0    src/utils/urlfieldlogic.h [from: src/gui/urlfieldlogic.h - 100% similarity]

https://invent.kde.org/office/tellico/-/commit/2e2b73fbff33e0323cc94e33e02fb8409a1c22c7
Comment 2 Robby Stephenson 2023-09-23 02:08:42 UTC
Git commit 81a4dad2ce92f1642e854c0aaff6a932b2a10bae by Robby Stephenson.
Committed on 23/09/2023 at 04:08.
Pushed by rstephenson into branch '3.5'.

Use same relative url logic when writing XML output
FIXED-IN: 3.5.2

M  +0    -1    src/gui/CMakeLists.txt
M  +1    -1    src/gui/urlfieldwidget.h
M  +1    -2    src/tests/CMakeLists.txt
M  +1    -1    src/tests/fieldtest.cpp
M  +1    -0    src/tests/tellicoreadtest.cpp
M  +7    -4    src/translators/tellicoxmlexporter.cpp
M  +1    -0    src/utils/CMakeLists.txt
R  +0    -0    src/utils/urlfieldlogic.cpp [from: src/gui/urlfieldlogic.cpp - 100% similarity]
R  +0    -0    src/utils/urlfieldlogic.h [from: src/gui/urlfieldlogic.h - 100% similarity]

https://invent.kde.org/office/tellico/-/commit/81a4dad2ce92f1642e854c0aaff6a932b2a10bae