pluc icon indicating copy to clipboard operation
pluc copied to clipboard

🐛 Deletion of entire alias file

Open dawsbot opened this issue 8 years ago • 5 comments

I think this is why: Under situations where config.json is invalid json,

The entire file is deleted upon transpilation of aliases. This is an issue because it means if you do not backup your aliases, all are gone when executing pluc --transpile.

A proposed fix would be to avoid writing to config.json if the object is empty or smaller than the previous object.

dawsbot avatar Apr 04 '17 19:04 dawsbot

Facing this issue, though it seems the config.json is valid json. Periodically, this issue occurs. Not sure how to reproduce it.

rcornacchia avatar Apr 12 '17 18:04 rcornacchia

I was able to replicate the issue with the following alias:

echo \$\1

Need to take a peek into dependencies to figure out why

dawsbot avatar Apr 27 '17 08:04 dawsbot

Able to replicate this issue by saving two aliases with the same key back-to-back.

Proposed Solution

If JSON object has fewer entries than it did before the recent call, do not save to file.

dawsbot avatar Dec 15 '17 18:12 dawsbot

Solved! Spotted the issue at least. One solution is to halt reading from the json object if it's invalid json: https://github.com/dawsbot/dotless-conf/issues/2

Will work on this at a later time, but if anyone wants to take on that ticket go for it!

dawsbot avatar Apr 16 '18 18:04 dawsbot

Re-opening until we can confirm this issue is entirely gone

dawsbot avatar Aug 05 '18 09:08 dawsbot