Skip to content
This repository has been archived by the owner on Sep 26, 2020. It is now read-only.

function isValidFileName is buggy #128

Closed
thomastay opened this issue Aug 26, 2019 · 0 comments · Fixed by #129
Closed

function isValidFileName is buggy #128

thomastay opened this issue Aug 26, 2019 · 0 comments · Fixed by #129

Comments

@thomastay
Copy link

Describe the bug
The function isValidFileName, located in src/Forge.ProjectSystem/Prelude.fs is buggy on Linux systems.
This function relies on concatenating the output of Path.GetInvalidPath Chars and Path.GetInvalidFileNameChars, then checking to see if the full pathname has any characters in the concatenation of those two lists.

However, a full pathname may have characters which are valid path characters but invalid file name characters. E.g. on Linux GetInvalidFileNameChars() returns '/', which is used in the full pathname.

This is affecting upstream the VSCode rename plugin when attempting to rename files.
Github issue

To Reproduce
Steps to reproduce the behaviour:

  1. On a Linux box, run this command (fill in the blanks with your filename)
$ dotnet run --project src/Forge rename file -n /home/[user]/[...]/new.fs -r /home/[user]/[...]/new1.fs -p /home/[user]/[...]/[projectName].fsproj
> Cannot Rename File - invalid name

Expected behaviour
File is renamed

Ideas to fix
Split pathname into file name and path name, and check independently therein. I will work on a PR for this, if this issue is confirmed to be a bug.

Environment (please complete the following information):

  • OS: Ubuntu 18.04
  • Ionide version: 4.0.6
  • VSCode version: 1.37.1
  • dotnet SDK version: 2.2.401
  • dotnet core version: 2.2.6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant