-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
🎨 Backup redirects file before overriding #9051
Conversation
refs TryGhost#9028 - if you upload a redirects file and a redirects file exists already, we backup this file to `data/redirects-YYYY-MM-DD-HH-mm-ss.json` - decrease chance of random test failures by not comparing date format with seconds
195a589
to
ef11401
Compare
@kevinansfield Added date-time format for redirect backup files as discussed in slack. |
👍 local install is creating backups OK. I'm seeing backups created for failed uploads too - is that expected? |
This would make the logic more complicated, so i decided to ignore this. In worst case it would create a backup of a none changed redirects file. A failed upload should only occur if your file format is wrong. |
We've run into this before, there is a solution written here with a big explanation. We already have an overrides file, I think it might be a good idea to add |
I think for Ghost, where we already have an overrides.js file that lives at all the right places, it makes more sense, than it might in other cases. For us, I think the problem is the opposite. I've wasted too much time bashing my head against a promise chain because I used a catch predicate on a promise that wasn't a bluebird promise because it came from some library somewhere and wasn't handled & "wrapped" with bluebird. We saw this same problem set us back a couple of days on the image size refactor project. We are so accustomed to using catch predicates, and they work so well with the way our code is written, I think we would be less likely to trip ourselves if everything was bluebird than we currently are with a mix. That's just my opinion though 😊 |
refs #9028
data/redirects-YYYY-MM-DD-HH-mm-ss.json
NOTE: We would love to use the promise support by fs-extra which was added in 3.x, but they are using native Promises and Ghost uses Bluebird. There is an open issue which discusses this topic. As long as fs-extra does not support alternative Promise libaries, we have to use
promisify
for fs extra calls, otherwise e.g. the catch behaviour is different.