modmore / Gitify

Command line toolkit to make managing a MODX site in git a lot easier.
MIT License
122 stars 55 forks source link

Gitify extract overwrites resources with the identical alias #303

Open achterbahn opened 5 years ago

achterbahn commented 5 years ago

Summary

Resources are overwritten during Gitify extract when two resources have the same alias

Step to reproduce

  1. Create a resource (ex. pagetitle "test"), save it. -> Alias "test" is generated (ex. with id=1)
  2. Delete created resource
  3. Duplicate deleted resource, open it, give it the same title "test" and save. -> Alias "test" is generated.
  4. `Gitify extract``
  5. Result: only one resource is extracted. Acutally both are extracted but since the name of the export file test.html is built with only the alias, it will be overwritten. One resource will be lost.

Observed behavior

Resources with the same alias will be overwritten.

Expected behavior

Resources should not be overwritten if they have the same alias.

Environment

Gitify 0.12.0, MODX 2.7.2, LAMP Stack

Mark-H commented 5 years ago

As multiple resources with the same alias can't show up in the front-end, that's sort of an invalid condition to begin with.

I'm also not sure how that could be prevented. That would mean stepping away from the alias (/URI) for the primary key on the content, which is a key thing.

achterbahn commented 5 years ago

We had the problem with a end user of MODX who did exactly how I described it. The other solution of not letting this happen is to prevent that resources have the same alias in any case (even with deleted resources). With key thing you mean breaking changes?

Mark-H commented 5 years ago

With key thing I mean that the whole point of using the alias as primary key, is that it doesn't have to use the ID... so it can handle ID conflicts and such better.