kevboh / longform

A plugin for Obsidian that helps you write and edit novels, screenplays, and other long projects.
Other
610 stars 30 forks source link

It is possible to name a scene using an illegal filename on Windows #213

Closed thesamim closed 5 months ago

thesamim commented 7 months ago

Versions Longform version: 2.0.4 Obsidian version: 1.4.16 OS [e.g. macOS, Windows, iOS, Android]: Windows Theme: Simple Other plugins that you think might be relevant here:

Describe the bug When adding scenes from the longform panel, it is possible to enter a name with characters that can be used in a file name. eg: The "Cabin". Quotes are not allowed in filenames.

To Reproduce Steps to reproduce the behavior:

  1. Go to longform panel
  2. Go to Scenes
  3. Add The "Cabin"
  4. Scene is added to the scene list.
  5. Click on The "Cabin" in Scene list.
  6. Get filename warning. Can't delete the scene from longform panel.
  7. Had to go index.md and manually delete the scene.

Expected behavior There should be a warning when a scene is named using illegal filename characters, and the user prevented from using those characters.

kevboh commented 7 months ago

Quotes are a legal title character in Obsidian:

image

Is this specific to Windows, maybe?

b-camphart commented 7 months ago

My suggestion would be that we fix this by not adding a scene to the scene list until the OS has confirmed creation. If it fails, we display the error inline. This way, we don't have to recreate the filename checking that the OS already does. This is more of a consistency problem between two sources of truth.

thesamim commented 7 months ago

Quotes are a legal title character in Obsidian:

image

Is this specific to Windows, maybe?

image

Must be.

kevboh commented 7 months ago

A simple fix: don't use Windows :)

I'll take a look. Thanks for filing!

kevboh commented 5 months ago

I can't test on windows because I don't have a windows machine, but https://github.com/kevboh/longform/commit/7cad255c055e503574dd4f283281c4ba9c42f289 should fix this. Will be in next release.