question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a new post will overwrite an existing post when the file already exists

See original GitHub issue

Description:

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:

  1. Create a new (first) post with the title as “test” and no path.
  2. Add some content to the first post.
  3. Create the first post.
  4. 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.
  5. Add some different content to the second post.
  6. 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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mertkahyaoglucommented, Aug 12, 2019

IMO, adding a number (filename_1) is a good way to solve this issue.

1reaction
alzeihcommented, Oct 13, 2019

Replying to remove stale label.

Raising an error would be fine by me. I just want to avoid overwriting an existing file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overwrite file if it already exist - Power Platform Community
I am having a flow where I convert some Word documents to PDF, when the Word document are being updated or created. Then...
Read more >
How to overwrite files using the create file action in Power ...
The solution to this has already been shared a fair few times via the Power Automate blogs, but here it is: ... Open...
Read more >
What is the difference between POST and PUT in HTTP?
POST means "create new" as in "Here is the input for creating a user, create it for me". PUT means "insert, replace if...
Read more >
PutItem - Amazon DynamoDB - AWS Documentation
Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as...
Read more >
Publishing Methods - Tableau Help
When the complete file has been sent to the server, you call Publish Data ... If overwrite-flag is set to true but the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found