fix: Character escaping
parent
829a50492c
commit
a6035e16ae
|
@ -25,8 +25,7 @@ module.exports = () => ({
|
|||
if (shouldExclude) return;
|
||||
|
||||
// Replace reserved characters in filenames.
|
||||
configName = configName.replace(/:/g, "#");
|
||||
configName = configName.replace(/\//g, "$");
|
||||
configName = configName.replace(/:/g, "#").replace(/\//g, "$");
|
||||
|
||||
// Check if the JSON content should be minified.
|
||||
const json = !strapi.config.get('plugin.config-sync').minify
|
||||
|
@ -61,8 +60,7 @@ module.exports = () => ({
|
|||
if (shouldExclude) return;
|
||||
|
||||
// Replace reserved characters in filenames.
|
||||
configName = configName.replace(/:/g, "#");
|
||||
configName = configName.replace(/\//g, "$");
|
||||
configName = configName.replace(/:/g, "#").replace(/\//g, "$");
|
||||
|
||||
fs.unlinkSync(`${strapi.config.get('plugin.config-sync.syncDir')}${configName}.json`);
|
||||
},
|
||||
|
@ -76,8 +74,7 @@ module.exports = () => ({
|
|||
*/
|
||||
readConfigFile: async (configType, configName) => {
|
||||
// Replace reserved characters in filenames.
|
||||
configName = configName.replace(/:/g, "#");
|
||||
configName = configName.replace(/\//g, "$");
|
||||
configName = configName.replace(/:/g, "#").replace(/\//g, "$");
|
||||
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
return readFile(`${strapi.config.get('plugin.config-sync.syncDir')}${configType}.${configName}.json`)
|
||||
|
@ -111,8 +108,7 @@ module.exports = () => ({
|
|||
const name = file.split(/\.(.+)/)[1].split('.').slice(0, -1).join('.'); // Grab the rest of the filename minus the file extension.
|
||||
|
||||
// Put back reserved characters from filenames.
|
||||
let formattedName = name.replace(/#/g, ":");
|
||||
formattedName = name.replace(/\$/g, "/");
|
||||
const formattedName = name.replace(/#/g, ":").replace(/\$/g, "/");
|
||||
|
||||
if (
|
||||
configType && configType !== type
|
||||
|
|
Loading…
Reference in New Issue