mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
fix: preserve save-as backups and register history CLI routes
This commit is contained in:
1 parent
ea9461c085
commit
91e6005152
6 files changed
+152
-3
No files matched your search
@@ -295,6 +295,15 @@ export default (app: Router) => {
|
||||
fileExists &&
|
||||
resolveFileAccess(config.scriptPath, [filePath], config.blackFileList)
|
||||
) {
|
||||
// Save-as removes the source after committing the destination. Keep
|
||||
// its original content too: destination history only protects the
|
||||
// file being overwritten, not the source being deleted.
|
||||
if (filename !== originFilename) {
|
||||
await fs.copyFile(
|
||||
originFilePath,
|
||||
join(config.bakPath, originFilename.replace(/\//g, '')),
|
||||
);
|
||||
}
|
||||
const data = await historyService().save(path, filename, content, {
|
||||
skipHistory: req.body.skipHistory,
|
||||
expectedHash: req.body.expectedHash,
|
||||
|
||||
Reference in new issue
Block a user