Bug 446279 - Resource files that failed to import stay in the resource folder (shouldn't they be removed?)
Summary: Resource files that failed to import stay in the resource folder (shouldn't t...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: git master (please specify the git hash!)
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-30 14:57 UTC by Tiar
Modified: 2022-02-22 23:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tiar 2021-11-30 14:57:14 UTC
SUMMARY
If the user tries to import a resource file and the import ends up in a failure state, the resource file is still copied to the resource folder.

STEPS TO REPRODUCE
1. Go to Patterns docker, try to import a file called "pattern.png~" (which will fail because of wrong filename).

OBSERVED RESULT
You can see that the file is there in the resource folder after you click through all messages.

EXPECTED RESULT
The file shouldn't be there since the import failed.

SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0-prealpha (git aab049f)
 Languages: en_US, en, en_US, en, en_US, en, pl_PL, pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.11.1
  Version (loaded): 5.11.1
Comment 1 wolthera 2021-12-01 12:54:46 UTC
Yes, they should be removed if possible.
Comment 2 Halla Rempt 2022-01-04 09:45:39 UTC
Yes, they should removed. Please implement this?
Comment 3 Bug Janitor Service 2022-01-06 19:28:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1284
Comment 4 Tiar 2022-01-08 21:39:29 UTC
Git commit c76519a76452f6d7cdd2eba0911861f3ad88dd6e by Agata Cacko.
Committed on 08/01/2022 at 21:38.
Pushed by tymond into branch 'master'.

Don't leave incorrect resource files after loading

Before this commit, KisFolderStorage wouldn't check if the
resource can be loaded after importing, so it didn't even know
that maybe it imported an incorrect file which is later
staying in the resource folder unnecessarily.
This commit adds checking for whether the resource can be loaded
immediately after copying it to the folder, and then removes it
if the resource file is incorrect.

M  +7    -0    libs/resources/KisFolderStorage.cpp

https://invent.kde.org/graphics/krita/commit/c76519a76452f6d7cdd2eba0911861f3ad88dd6e
Comment 5 Tiar 2022-02-22 23:14:56 UTC
Git commit 0ef02e5e43bc1ac6d03c0110379b9c169672165b by Agata Cacko.
Committed on 22/02/2022 at 22:51.
Pushed by tymond into branch 'krita/5.0'.

Don't leave incorrect resource files after loading

Before this commit, KisFolderStorage wouldn't check if the
resource can be loaded after importing, so it didn't even know
that maybe it imported an incorrect file which is later
staying in the resource folder unnecessarily.
This commit adds checking for whether the resource can be loaded
immediately after copying it to the folder, and then removes it
if the resource file is incorrect.
(cherry picked from commit c76519a76452f6d7cdd2eba0911861f3ad88dd6e)

M  +7    -0    libs/resources/KisFolderStorage.cpp

https://invent.kde.org/graphics/krita/commit/0ef02e5e43bc1ac6d03c0110379b9c169672165b