Skip to content

[bug]: Only substitute / for \ when the target platform is Windows #1234

Description

@ProofOfKeags

Prerequisites

  • I have searched for existing issues that already report this problem, without success.

EmbassyOS Version

075e68c

Device

Laptop/Desktop

Device OS

Linux

Device OS Version

Ubuntu 21.04

Browser

Brave

Browser Version

1.19.92

Current Behavior

Right now we do a full character substitution changing \'s to /'s when putting a path into the CIFS creation dialog. This will break the edge case where users may create a folder with a \ in it on Linux or Mac (which is valid) and they will be unable to use the share they created.

Expected Behavior

Ideally we want to only perform this substitution if the target drive is hosted on Windows, for which this substitution is always safe, and unambiguous. We do not, at present, have a means of telling EmbassyOS any information about the OS of the target drive. We should put this into the dialog. Ideally, it should also be persisted with the rest of the CIFS information so that upon edit, it need not be re-inputted.

Finally, if we go as far as persisting it, we need not actually perform the substitution on the FE at all. At that point, we can know at mount time that the drive is on windows and perform the substitution. This means that we only have to do the substitution oncce (on mount), as opposed to twice (once on the FE on save, and once on the FE on read).

Steps to Reproduce

  1. Create a backup
  2. Create a CIFS drive with a \ in the name on either Linux or Mac
  3. Put the information for that drive into the EmbassyOS dialog
  4. Save
  5. Notice that it fails to mount

Anything else?

It is invalid to use either / or \ in file names on Windows. It is invalid to use / in file names on Mac or Linux. This is what makes the substitution safe (and invertible) on Windows. But it is not safe on the other two platforms because it eliminates certain files from being used. It is also not invertible on the other platforms.

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingP3 - EventualThings of low consequence to ignoreUIIssues pertaining to any of the embassy-served web applicationsstartdIssues pertaining to startd itself

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions