Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why have you only modified this overload of
RenameFile
/Directory
- now the others are inconsistent in behavior? Is there a good reason?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is only happening when is trying to replace the image name inside the .md file with the hashed file name and this RenameFile(string file, string baseName, string shortName) method is doing that task,
e.g. for ByOriginVectors node the next values will be replaced.
baseName = "Autodesk.DesignScript.Geometry.CoordinateSystem.ByOriginVectors(origin, xAxis, yAxis, zAxis)"
shortName = "KLFVJ5DI7APVNODARMSE3JM5C27DG62OXUUQRS3HCDTZYO6IBOZA"
The other RenameFile(string file) function is calling RenameFile(string file, string baseName, string shortName), then I don't understand what you mean by "inconsistent in behavior".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation- that makes sense, so now all replace methods will eventually call down to this one and have the same behavior with decoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if with "now all replace methods" you refer to calling "string.Replace", this line updated just applies to the case of replacing the md file content, there are other calls to "string.Replace" that won't need to use HttpUtility.UrlDecode (like the image below) due that is replacing the file name and file names doesn't have the "%20" char.
There are two test cases for using "NodeDocumentationMarkdownGenerator rename" command, one is when renaming just a file and the other when renaming all the files in a folder. If you have a specific case in mind in which this code could not work, please let me know and I can test it. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, typo, I meant
Rename
not replace.RenameFile
RenameDirectory
I want to understand if this tool will now always do this decoding whenever it replaces the content inside a file while renaming no matter what code path is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will do the decoding whenever replaces the content inside a md file.
Here you can see a flow diagram showing that when using "rename" option in both cases will be decoding, I hope this diagram shows the behavior in a more clear way: