danpros / htmly

Simple and fast databaseless PHP blogging platform, and Flat-File CMS
https://www.htmly.com
GNU General Public License v2.0
1.1k stars 266 forks source link

draft posts pooled after common publish article click #789

Closed Aar-Noma closed 1 month ago

Aar-Noma commented 3 months ago

Describe the bug draft posts pooled after common publish article click

To Reproduce create new article, publish it and after some time this is in drafts, if you publish these drafts, you have 2 equal articles, the problem is previous shared links, if you delete wrong article of doubles every user loses previous links on article

Expected behavior after publish article not in drafts again

Screenshots/Errors If applicable, add screenshots and/or error messages to help explain your problem. You may need to check your webserver's error logs.

HTMLy Version 2.9.9

Server Info (please complete the following information):

danpros commented 3 months ago

Hello,

The auto save enabled? The article has the same title?

danpros commented 3 months ago

Please test it again and be more clear (provide step by step) because I can't reproduce it.

Aar-Noma commented 3 months ago

yes, autosave is on, article had the same name, articles were ordered in Drafts queue, what was more, one of them was impossible to publish from drafts, only stuck there, so I clicked delete article.. ones of such examples was: I made both articles public. One had my own slug, another one had autoslug. What is more server is having some strange behaviour, do you think my provider had been invaded by hackers? Attaching pics:

tu_nieco_nesedi

tu_nieco_nesedi2

danpros commented 3 months ago

The problem seems due to the post having the same slug. So it doesn't matter whether you use a custom slug or automatic, if the slug is the same then problems will arise.

Currently when creating a slug from title, htmly tries to check if the slug already exists and if it is already in use it will add the date timestamp after the slug. example: /post/already-used-slug become /post/already-used-slug-201408085034

This is not a bug but current htmly limitation because when editing the posts etc. it search for file that match the slug. In the future it can be developed further, for example by matching the categories, tags, author etc.

For server problems you should read the server log or contact/open ticket to your hosting provider.

danpros commented 3 months ago

So what is the solution without deleting the post? Just edit the post and change the slug and save. The problem should no longer occur because both posts now have different slugs.

danpros commented 1 month ago

This has been fixed in latest release. Thanks