Skip to content

Fix image editor save error after changing directories - #3735

Merged
nao-pon merged 6 commits into
Studio-42:masterfrom
jmario74:jmario74-patch-2
Aug 2, 2026
Merged

Fix image editor save error after changing directories#3735
nao-pon merged 6 commits into
Studio-42:masterfrom
jmario74:jmario74-patch-2

Conversation

@jmario74

@jmario74 jmario74 commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

when file is opened in the current directory, store the file node with "fm.file" function; then use it if the "fm.file" function can not find the file in the switched directory.

@nao-pon

nao-pon commented Apr 17, 2026

Copy link
Copy Markdown
Member

Thanks for the PR.

I can see the intention here, but I鈥檓 not comfortable merging this as-is.

I understand the reported issue in #3728, but on my side I could not clearly reproduce a save failure just by switching directories. After saving, elFinder posts the content back to the original file hash with put, and navigate.target = 'changed' then moves focus back to the changed file, so returning to the original directory after save looks like the expected existing behavior rather than the bug itself. ([GitHub]1)

Because of that, I鈥檓 not yet convinced that storing an extra loadedFile object on the editor is the right fix. In the current code, the MIME is already kept in the editor/dialog state ($base.data('mime') in the TUI path, and ifm.data('mime') in the Photopea path), so if fm.file(hash) can sometimes become unavailable, this looks like it should be handled with a smaller guard that simply preserves the existing MIME instead of introducing additional state. ([GitHub]2)

For now, I鈥檓 going to leave this unmerged unless we can get a clearer reproduction path or a smaller fix.

jmario74 added 3 commits May 3, 2026 06:26
Using nao-pon's guidance, supply the already stored file mime in "this.file.mime" to "$base.data('mime', this.file.mime)" rather than storing an extra loadedFile object on the editor.
@jmario74

Copy link
Copy Markdown
Contributor Author

Thanks nao-pon for taking a look at this, i have revised the fix using your guidance and used "this.file.mime" that has the stored file mime and supplied it to "$base.data('mime', this.file.mime)"; both "TUI" & "Photopea" are working properly. this looks like an isolated case, the bug was reported a while ago and there has been no additional reports since then; so i think this can be closed now and can serve as a reference to the issue for anybody who encounters it.

@nao-pon nao-pon changed the title fix bug (studio-42#3728) Fix image editor save error after changing directories Aug 2, 2026
@nao-pon
nao-pon merged commit 6b13ea8 into Studio-42:master Aug 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants