Skip to content

Commit 7e82c94

Browse files
committed
fix: path update in legacy rename behavior
Change username doesn't go through ll_move, and does not adhere to DRY alongside the /rename operation. This led to an inconsistency where the rename behavior in the change username operation didn't update the cached fsentry path.
1 parent 145d836 commit 7e82c94

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/src/helpers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ async function refresh_associations_cache(){
409409
// update username
410410
await db.write("UPDATE `user` SET username = ? WHERE `id` = ? LIMIT 1", [new_username, user_id]);
411411
// update root directory name for this user
412-
await db.write("UPDATE `fsentries` SET `name` = ? WHERE `user_id` = ? AND parent_uid IS NULL LIMIT 1", [new_username, user_id]);
412+
await db.write("UPDATE `fsentries` SET `name` = ?, `path` = ? " +
413+
"WHERE `user_id` = ? AND parent_uid IS NULL LIMIT 1",
414+
[new_username, '/' + new_username, user_id]
415+
);
413416

414417
const log = services.get('log-service').create('change_username');
415418
log.noticeme(`User ${old_username} changed username to ${new_username}`);

0 commit comments

Comments
 (0)