Skip to content

[RenameFile] Never overwrite or delete files; fix null job queue crash - #799

Open
dude-stash wants to merge 3 commits into
stashapp:mainfrom
dude-stash:fix/renamefile-null-taskqueue
Open

dude-stash wants to merge 3 commits into
stashapp:mainfrom
dude-stash:fix/renamefile-null-taskqueue

Conversation

@dude-stash

@dude-stash dude-stash commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #798

  • taskQueue treats a None job queue as empty, which fixes the 'NoneType' object is not iterable crash.
  • Fix the missing f prefix in isRunningPluginTaskJobOnTaskQueue.
  • When the new name (or an associated file's new name) already exists, use name (2), name (3), ... instead of renaming over it. This happens on scenes with two files: the plugin only renames files[0], and its computed name can match the other file's existing name, which the rename then overwrote. A case-only rename of the same file is still allowed.
  • Remove both os.remove calls. A failed rename now leaves the original file in place.
  • Apply the Max Tag Keys setting in getTags(). It was only enforced in add_tag(), which is never called, so every tag was always added.
  • Bump the plugin to 1.0.4.

Checked: the numbering and tag-limit logic on temp data, and confirmed in Stash that the second file of a two-file scene now gets name (2) instead of overwriting the first.

Not covered: renaming every file of a multi-file scene. The plugin still only renames files[0].

AI disclosure: this was written with Claude Code.

🤖 Generated with Claude Code

dude-stash and others added 2 commits October 17, 2026 23:30
job_queue() can return None, which crashed every taskQueue helper except
tooManyScanOnTaskQueue. Normalise it to an empty list, and fix the missing
f-string in the plugin-task job match.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
rename()/move() silently overwrite an existing target, so two files of one
scene that resolved to the same new name lost one of them. Pick a free
'name (N)' (checking associated files too) and drop both os.remove calls.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dude-stash
dude-stash force-pushed the fix/renamefile-null-taskqueue branch from 9adffe5 to 3ba544b Compare October 18, 2026 02:31
The limit lived in add_tag(), which nothing calls; getTags() joined every
tag. Apply the limit (and -1 for none) in getTags().

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dude-stash
dude-stash force-pushed the fix/renamefile-null-taskqueue branch from 3ba544b to 3fbc1bc Compare October 18, 2026 02:38
@DogmaDragon DogmaDragon added the type:plugin Plugins label Oct 18, 2026
@discourse-stashapp

Copy link
Copy Markdown

This pull request has been mentioned on Stash Forum. There might be relevant details there:

https://discourse.stashapp.cc/t/renamefile/1334/10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RenameFile] Rename can overwrite/delete files; crash on null job queue

3 participants