Creating a new post will overwrite an existing post when the file already exists
See original GitHub issueDescription:
Creating a new post will overwrite an existing post sometimes.
This happens when the filename where the post is to be saved is the same as an existing filename.
Tell us a bit about yourself:
- Version of JekyllAdmin I’m using <HINT: use
bundle show
to check>: jekyll-admin (0.8.1) - Version of Jekyll I’m using <HINT: use
bundle show
to check>: jekyll (3.8.5) - Version of NodeJS I’m using <HINT: use
node -v
to check>: none - Operating System <e.g. OS X, Windows>: linux
- Browser <e.g, Safari, Chrome>: Chrome
Steps to reproduce:
- Create a new (first) post with the title as “test” and no path.
- Add some content to the first post.
- Create the first post.
- Then, create another new (second) post also with the title “test” and no path. This should be done close enough in time to the first one, i.e: the same day usually.
- Add some different content to the second post.
- Create the second post.
I expected the following:
The second post should not not overwrite the first post.
But got the following, instead:
The first post will be replaced by the second post, and the first post is lost.
Other details:
This isn’t quite so bad with posts as the filename usually contains a date, so it’s less likely to accidentally happen.
With collections though which the title can be the only element that ends up in the filename, it’s easier to overwrite an existing item in a collection. (repeat steps above with a collection other than posts that doesn’t have a date in the file name / path.)
Overwriting the file makes sense for editing existing posts, but I don’t think it makes sense when creating new posts. (Same for collections.)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
IMO, adding a number (filename_1) is a good way to solve this issue.
Replying to remove stale label.
Raising an error would be fine by me. I just want to avoid overwriting an existing file.