Skip to content

Commit

Permalink
do not rename ops in packaged version
Browse files Browse the repository at this point in the history
  • Loading branch information
steam0r committed Sep 24, 2024
1 parent c84892f commit 2dc8bb2
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions src/utils/ops_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,42 @@ class OpsUtil extends SharedOpsUtil

userHasWriteRightsOp(user, opName, teams = [], project = null)
{
if (!user) return false;
if (!opName) return false;
if (!opName.startsWith(this.PREFIX_OPS)) return false;
if (opName.indexOf("..") > -1) return false;
if (opName.indexOf(" ") > -1) return false;
if (opName.startsWith(".")) return false;
if (opName.endsWith(".")) return false;

const validName = this.isOpNameValid(opName);
if (!validName) return false;

const file = this.getOpAbsoluteFileName(opName);
if (file && fs.existsSync(file))
if (file)
{
try
if (fs.existsSync(file))
{
fs.accessSync(file, fs.constants.R_OK | fs.constants.W_OK);
return true;
try
{
fs.accessSync(file, fs.constants.R_OK | fs.constants.W_OK);
return true;
}
catch (e)
{
// not allowed to read/write
return false;
}
}
catch (e)
else if (this._cables.isPackaged() && file.startsWith(this._cables.getOpsPath()))
{
// not allowed to read/write
return false;
}
else
{
return true;
}
}

return true;
}

Expand Down

0 comments on commit 2dc8bb2

Please sign in to comment.