rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: mhoney on May 18, 2018, 05:28:34 PM

Title: BUG - Renaming Directory or File Breaks Description / Comment
Post by: mhoney on May 18, 2018, 05:28:34 PM
Like the subject says, if you rename a file or directory that has an existing comment you break the link and that info disappears.  It's still in the text file but doesn't get updated.
Title: Re: BUG - Renaming Directory or File Breaks Description / Comment
Post by: Mars on May 18, 2018, 09:27:11 PM
the comments have never been fully managed, there are three types of recordings, but the most used is the recording in a file named hfs.comments.txt for the real directories

it is easy to manage comments when renaming file by using this modified section in the template
Code: [Select]
[ajax.rename|no log]
{.check session.}
{.break|if={.not|{.can rename.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|from.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|to.}.}|result=forbidden.}
{.set|x|{.force ansi|%folder%{.postvar|from.}.}.}
{.set|y|{.force ansi|%folder%{.postvar|to.}.}.}
{.break|if={.not|{.exists|{.^x.}.}.}|result=not found.}
{.break|if={.exists|{.^y.}.}|result=exists.}
{.comment| "from here we manage the comment assignment using the dedicated macros" .}
{.set|comment| {.get item|{.^x.}|comment.} .}
{.comment| "it is necessary to remove the comment from the source file before attempting to rename it" .}
{.set item|{.^x.}|comment=.}
{.set|hasrenamed|{.length|{.rename|{.^x.}|{.^y.}.}.}
{.comment| "depending on whether the file has been renamed or not, the comment is attributed to the resulting name" .}
{.set item|{.if|{.^hasrenamed.}|{:{.^y.}:}|{:{.^x.}:}/if.}|comment={.^comment.}.}
{.set|comment|.}
{.break|if={.not|{.^hasrenamed.}.}|result=failed.}
{.add to log|User %user% renamed "{.^x.}" to "{.^y.}".}
{.pipe|ok.}
Title: Re: BUG - Renaming Directory or File Breaks Description / Comment
Post by: rejetto on May 22, 2018, 09:45:22 PM
if you rename the file by using HFS itself, and you are using the latest version of default template, the comment is expected to be updated.

If you press F6 you should see this:
Welcome! This is the default template for HFS 2.3
template revision TR2.


if it doesn't say TR2 then your template is outdated.