New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add folder in node folder does not check folder name #1027

Closed
fodrice opened this Issue Sep 20, 2018 · 10 comments

Comments

Projects
None yet
2 participants
@fodrice
Contributor

fodrice commented Sep 20, 2018

  1. Note -> Setup note folders -> add folder
  2. paste this to folder name
    файл на русикі почти qdqw 君の名は。 87/файл на русикі почти qdqw 君の名は。1. нкопо437какуацуак7цук 87 /файл на русикі почти qdqw 君の名は。1. нкопо437какуацуак7цук 87
    Yes with everything include line break and slash.
    3)Expected folder name error. But there isn't.
@pbek

This comment has been minimized.

Owner

pbek commented Sep 20, 2018

Thank you for reporting, I will try to reproduce your issue.

@pbek

This comment has been minimized.

Owner

pbek commented Sep 22, 2018

When I enter that folder under KDE Neon (Linux) and press OK the dialog just closes but the folder will not be used. That is the default behavior of the directory open dialog if it was fed with a folder previously.

@pbek

This comment has been minimized.

Owner

pbek commented Sep 22, 2018

If I do it under Windows I'll get an error from the directory-open dialog that the folder doesn't exist.

@pbek

This comment has been minimized.

Owner

pbek commented Sep 22, 2018

So I can't reproduce your issue...

@fodrice

This comment has been minimized.

Contributor

fodrice commented Sep 22, 2018

Sorry, I mentioned it wrong. (I'm using linux)

  1. Go to Note -> Setup note folders -> add folder
  2. than copy this lines
    break_gui.txt
    and paste it into "Name field"
    default
  3. Than specify node folder path to some folder.
  4. Press Ok
  5. Now you've got some gui broken because of big folder name with more than one line
    default
  6. And one more, Shortcuts settings seems not remove removed folders (have to got only two folders but got many) and it looks ugly.
    default
  7. If you add note folder widget and try to choose the folder when folder with long name exists it expands on the whole screen.
    default
  8. Can't reproduce random folder creating bug (perhaps I did something that I can't remember), but it doesn't matters now cause the simplest solution for 5 is to check folder name on harmful symbols like line breaks and line length (255 as most filesystems file max name length and return error).
    Something like this:
bool isLegalFolderName(QString name){
  const QString illegal="/\\\n";
  const int max_utf8_length=255;
  
  // Utf8-length string must be less than 255 
  if (name.toStdString().length()==max_utf8_length)
    return false;
  
  foreach (const QChar& c, name){
    // Check for control characters
    if (c.toLatin1() > 0 && c.toLatin1() < 32)
      return false;

     // Check for illegal characters
    if (illegal.contains(c))
      return false;
  }
  return true;
}

And crop long folder names when displaying it in gui.

  1. Also It is possible to add folder with non existent file path. By default it fills folder name with something like /home/Fodrice/Nextcloud/Notes. And it is possible to apply changes without any warning if that path did not exists. Not a big problem, It just will not work.
@pbek

This comment has been minimized.

Owner

pbek commented Sep 23, 2018

I cannot even keep up with your complains, nor understand all of the,. :) You really should start building QOwnNotes yourself and work on them.

So you are complaining that if you are using a 200 character folder "short-name" that certain gui elements of Qt are having a hard time viewing them?

pbek added a commit that referenced this issue Sep 29, 2018

@pbek

This comment has been minimized.

Owner

pbek commented Sep 29, 2018

18.09.5

  • note folder names in the Note folders settings will now be truncated at 50
    characters and new-line characters will be removed

@pbek pbek added this to the 18.09.5 milestone Sep 29, 2018

@pbek

This comment has been minimized.

Owner

pbek commented Sep 29, 2018

There now is a new release, could you please test it and report if it works for you?

@fodrice

This comment has been minimized.

Contributor

fodrice commented Sep 30, 2018

Works for me.

@pbek

This comment has been minimized.

Owner

pbek commented Sep 30, 2018

Great, thank you for testing!

@pbek pbek closed this Sep 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment