Describe the bug
We noticed that file locks are not respected if a user accesses a script file directly via a URL rather than through the built-in File -> Open dialog
Claude dispositioning below:
File → Open (via FileOpenSaveDialog):
- openSuccess() calls Api.get('/script-api/scripts/${file}') → server auto-locks
- Emits 'file' event → ScriptRunner calls setFile(data) with local = false (default)
- In setFile with local = false: lockedBy is updated from the response → UI shows lock warning
URL open (?file=...):
- mounted() sets this.filename then calls reloadFile()
- reloadFile() calls Api.get(...) → server auto-locks
- Then calls setFile(data, true) with local = true ← this is the problem
- In setFile, the if (local === false) block is entirely skipped → lockedBy is never updated
- UI shows no lock warning even if another user holds the lock
This is a real bug. reloadFile() always passes local = true to setFile, which was intended to mean "don't unlock the old file before switching" (since it's reloading the same file), but the side effect is that lock state from the
response is silently discarded.
To Reproduce
- Enable script file locks in the admin console
- Open a script via the file open dialog in one window
- In a new window, reopen that script via the file open dialog, confirm it is locked
- Copy the URL for the script (e.g. https://.com/tools/scriptrunner?file=) In a new window. The file does not appear locked
Expected behavior
The file is locked by the original user
Screenshots
No response
OS
No response
OpenC3 COSMOS Version
7.2.0
Browser
Chrome
Describe the bug
We noticed that file locks are not respected if a user accesses a script file directly via a URL rather than through the built-in File -> Open dialog
Claude dispositioning below:
To Reproduce
Expected behavior
The file is locked by the original user
Screenshots
No response
OS
No response
OpenC3 COSMOS Version
7.2.0
Browser
Chrome