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