Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplication prevention #731

Closed
gerwitz opened this issue Apr 4, 2024 · 2 comments · Fixed by #765
Closed

Duplication prevention #731

gerwitz opened this issue Apr 4, 2024 · 2 comments · Fixed by #765
Labels
enhancement New feature or request

Comments

@gerwitz
Copy link

gerwitz commented Apr 4, 2024

Is your feature request related to a problem?

I use a client (the iOS/macOS Drafts app with a custom script) to send Micropub posts to Indiekit. It's too easy for me to accidentally send more than one, which results in me scrambling to stop Indiekit before it syndicates and clean up my git repo.

Describe the solution you’d like

Reject posts that exactly match existing posts, aside from time.

Describe alternatives you’ve considered

Being more careful.

Additional context

No response

@gerwitz gerwitz added the enhancement New feature or request label Apr 4, 2024
@paulrobertlloyd
Copy link
Collaborator

paulrobertlloyd commented Apr 4, 2024

I think there might be 2 issues at play here. You’re using the {slug} path token and that’ll create new randomly generated 5-character slug if no mp-slug or name property is provided.

The second is that maybe in this case, an update action should be performed instead.

Quickly looking into how things stand at the moment, I think there might be untold issues converting a create action item with the same properties into an update action (not impossible but… icky).

I wonder however… all the tokens used are based on post property values (typically published); this means they won’t change unless the source properties change. However, falling back to a randomly generated sequence breaks this convention, and can cause issues like this.

What do you think to this idea: change it so that {slug} falls back to, not to 5 randomly generated characters, but the first 7 digits of a MD5/SHA1 generated hash from the published value? This would mean successive saves of the same file (with the same published date and same name) would be written to the same file. Would that fix this issue? (I should probably make this change anyway…)

@paulrobertlloyd
Copy link
Collaborator

Hmmm, so each new create action has an updated published date (of course), so the above suggestion makes no difference.

Back to the drawing board…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants