BaldissaraMatheus / Tasks.md

A self-hosted, Markdown file based task management board
https://hub.docker.com/r/baldissaramatheus/tasks.md
MIT License
473 stars 15 forks source link

cards not saving when certain characters are in the title #93

Closed kuromad closed 15 hours ago

kuromad commented 4 months ago

I have noticed that once you use certain characters in the title of a card (like # \ ), it accepts the new name, and it is renamed in the file system. But all further modifications like editing content, renaming, moving lanes or deletion are not saved. It requires manual intervention to rename/remove those files to clean them up.

Perhaps a check and error message on the existence of those characters (and other characters disallowed in most filesystems) when renaming a card is a simple solution.

Thank you for your work. This tool makes my (work)life a lot easier.

michaelborn commented 3 months ago

Looks like this section of code that renames the card:

https://github.com/BaldissaraMatheus/Tasks.md/blob/main/backend/server.js#L173

could use some token replacement:

const newName = (ctx.request.body.name || name)
  .replaceAll( /\s/g, '-' )
  .replaceAll(/[^a-z_-]/gi, '' )
  .replaceAll('--','-'); 

This converts something like: "good, crazy / wild healthy food!" to "good-crazy-wild-healthy-food".

AdrienCos commented 1 month ago

Looks like this section of code that renames the card:

main/backend/server.js#L173

could use some token replacement:

const newName = (ctx.request.body.name || name)
  .replaceAll( /\s/g, '-' )
  .replaceAll(/[^a-z_-]/gi, '' )
  .replaceAll('--','-'); 

This converts something like: "good, crazy / wild healthy food!" to "good-crazy-wild-healthy-food".

I think that the third replaceAll function should be changed to :

    .replaceAll(/-+/g, '-')

Otherwise, a --- would only be replaced with -- instead of a -.

I would also suggest choosing between dashes and underscores, to have a consistent file naming scheme.

BaldissaraMatheus commented 6 days ago

Looks like this section of code that renames the card:

https://github.com/BaldissaraMatheus/Tasks.md/blob/main/backend/server.js#L173

could use some token replacement:

const newName = (ctx.request.body.name || name)
  .replaceAll( /\s/g, '-' )
  .replaceAll(/[^a-z_-]/gi, '' )
  .replaceAll('--','-'); 

This converts something like: "good, crazy / wild healthy food!" to "good-crazy-wild-healthy-food".

I think it makes sense to keep white spaces as it makes it easier to read it in the board. I'm preparing a new PR that includes a validation in the frontend app that prevents updating a card/lane name with reserved characters, so it won't even make a request to the API. It also includes a regex in this section to replace those characters, just in case

michaelborn commented 3 days ago

I think it makes sense to keep white spaces as it makes it easier to read it in the board.

Not attacking, just asking... why do filenames need to match the displayed title?

BaldissaraMatheus commented 3 days ago

I think it makes sense to keep white spaces as it makes it easier to read it in the board.

Not attacking, just asking... why do filenames need to match the displayed title?

I want it to feel like the cards and the files are the same thing as much possible, as the board was just a frontend view for them. Being this way makes it easy to navigate and makes it clear on how changing a file in one place affects it in the other one.

Also the app doesn't use any database, which means that if they were different we'd need to find way to map one thing to the other, so it's one less thing to worry about