Closed abhishekchoudhary closed 2 months ago
Hi @abhishekchoudhary
I am totally unable to reproduce this issue - I have tried:
1) add image to WYSIWYG editor post via image upload icon and via drag'n'drop - both are working correctly 2) add image to WYSIWYG editor post as in point 1. but with changed sites directory - also it is working fine
In all cases in database I have #DOMAIN_NAME#
instead of full path what is a correct behaviour.
Maybe you are uploading preview files? Because I have no other idea how it is possible to achieve such paths on the server.
I think I have the same thing since I am using publii in January 2024 https://github.com/GetPublii/Publii/discussions/1610
I've tried all combinations of image sources - I have verified that I am adding it from valid sources (not preview).
I tried a few more things - this seems to only be happening to one of my sites (for now) - I've tried everything up to clean install with restoration from backup. Happy to debug this further if you can point me in the right direction.
Current workflow - the site has 1 published page, which has been marked as the homepage. Everything works as expected when previewing, but when deployed, the link is still pointing to my local filesystem.
An additional, reproducible bug is that once I create and deploy a page, going back to it breaks the content even locally because the system is checking for media files under "$USER-Publii-path/site-name/input/media/pages/page-number/file", but there is no such directory created on mine - everything is still under .../posts/... - so this is reproducibly breaking for me.
@abhishekchoudhary - I have found a reason of the issue with invalid paths in editor, it will be fixed tonight in hot fix. Regarding your main issue - I still have no idea what causes it as I cannot reproduce this problem :/
@abhishekchoudhary - could you check in the website database if the problematic file has full local path in page content or do you have #DOMAIN_NAME#
string before filename?
The problematic file has the full local path.
In the text dump below, I've manually modified post 1 to include relative path of the file. The image in post 2 somehow has the same problem, but post 3 is fine. Post 4 has the same issue. Post 5 is fine for the first image, but has an issue with the second image.
This is one weird bug.
sqlite> select * from posts;
1|Home|1|home|<div class="hero framed">
<h6 class="align-center">september 28, 2024</h6>
<h5 class="align-center">maya bazaar, jayamahal palace exhibition center, bangalore</h5>
<img class="post__image" src="/media/posts/1/IMG_0204-2.jpg" alt="" width="5845" height="4135"></div>
<div> </div>
<div><img class="post__image" src="file:///Users/choudharism/Blogs/main/aditis-cafe/input/media/posts/1/2610426.jpg" alt="" width="4059" height="3264"></div>
<div class="posts"> </div>|15|1724036586503|1724053111834|published,is-page|empty
2|Test|1|test|<p><img class="post__image" src="file:///Users/choudharism/Blogs/main/aditis-cafe/input/media/posts/2/1.jpg" alt="" width="1500" height="1300"></p>|13|1724045461037|1724045480779|published,is-page,trashed|
3|Test|1|test-2|<p>This is a test<img class="post__image" src="#DOMAIN_NAME#/1-2.jpg" alt="" width="1500" height="1300"></p>|14|1724052960785|1724052960785|published,is-page|
4|home|1|home-2|<h6 class="align-center">september 28, 2024</h6>
<h5 class="align-center">maya bazaar, jayamahal palace exhibition center, bangalore</h5>
<p> </p>
<p><img class="post__image" src="file:///Users/choudharism/Blogs/main/aditis-cafe/input/media/posts/4/IMG_0204.jpg" alt="" width="5845" height="4135"></p>|20|1724062341120|1724062716686|published,is-page|
5|super duper test|1|super-duper-test|<p>september whenever</p>
<p>someplace</p>
<p><img class="post__image" src="#DOMAIN_NAME#/choudharism_a_portal_to_paradise_hyperreal_and_retro-futuristic_00f992e9-c44d-4b13-80c3-936201edb245.png" alt="" width="1024" height="1024"></p>
<p><img class="post__image" src="file:///Users/choudharism/Blogs/main/aditis-cafe/input/media/posts/5/choudharism_two_large_buildings_on_a_barren_planet_a_conveyor_b_20a55ac1-e75d-430c-9177-5882d0934116.png" alt="" width="1536" height="768"></p>|22|1724062962389|1724084091646|published,is-page|
@abhishekchoudhary - I have found a reason of your issue in the meantime and it is fixed by my latest commit, because all these issues have the same root :)
In short - this issue appears in some save/save&close configurations when our code replacing file path to #DOMAIN_NAME# shortcode fails
hot fix release will be available tonight - @bobmitro will let you know :)
Thank you for finding the second issue, because it was a good tip :)
Thank you for such a fantastic turnaround. Big fan of Publii!
Being stuck was fun because it helped me poke around a little bit, and I ended up creating a couple of plugins which I think can help the community. I'll open a separate issue to get those deployed soon!
Hotfix 0.46.0 build 16904 released.
I seem to be on the latest build, but seeing the same behaviour for now. I've restarted the app, deleted everything from the page and re-entered the data. Is there anything else I should do to see the fix in action?
I made a mistake in the previous message. The correct version is Hotfix 0.46.0, build 16908. Sorry about that.
Thanks Bob. I've requested a change to the homebrew cask so the brew install
command stops failing.
https://github.com/Homebrew/homebrew-cask/pull/183005
Might I suggest making homebrew ask update a part of your release cycle. :-)
Seems to be fixed!
Hi @dziudek - I've found another failure case. When I copy/paste image files between pages (WYSIWYG editor), I still get local links to deployed sites. However, if I "create" the image element on the target page, it seems to work fine. I thought I'd reopen the same bug and let you folks know.
Hi, I'm using Publii 0.46.1 and seem to have the same issue as reported. After adding an image via the WYSIWG editor, the URL in the WYSIWYG HTML viewer shows the full local path. I noticed it because I'm sharing the site development with someone else who has a different local path, so images don't work between us.
Let me know if there's any further info that would be helpful. Or if it's an entirely separate bug and I should use a new issue! Thanks!
@Odaeus - do you have this issue do copy-paste of image or you have added the image in the different way?
@abhishekchoudhary - this case is a bigger issue to solve, because when you copy-paste image it is not uploaded to the specific post images directory. Also paths from other posts are not converted properly. At this moment you should avoid it and I will try to find a solution for such case, but it won't be probably easy
@dziudek I used the insert image toolbar button. What's the expected src
value? I noticed that the image processor actually seems to return an absolute file path so perhaps this is expected behaviour? I thought it would be a relative path served by the Electron host.
@Odaeus - in post editor you will always have an absolute path to make the image working. But during save it is modified to use #DOMAIN_NAME#
shortcut. If you could - please check if in the database you have also absolute path in the post content (there is no other way to easily check it).
@dziudek I can see it's stored correctly in the DB. I must have a different issue that caused broken images. I'll open an issue if I'm able to reproduce. Thanks for the help! ❤️
Sounds like copy/pasting is not a new issue, and is not really related to the original bug I reported. I'll close it again. Thanks @dziudek - great work!
Operating system
macOS Sonoma 14.5
Publii version
0.46.0
Post editor
WYSIWYG editor
Bug description
Adding an image to my page, everything works fine locally, but Publii is no longer "managing" my file, and is simply uploading the page with links to my local filesystem.
Steps to reproduce
No response
Relevant log output
No response