Skip to content
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

unable to change the note path #1186

Open
teemuxyz opened this issue Dec 19, 2023 · 11 comments · Fixed by #1341 · May be fixed by #1342
Open

unable to change the note path #1186

teemuxyz opened this issue Dec 19, 2023 · 11 comments · Fixed by #1341 · May be fixed by #1342
Labels
3. to review bug Something isn't working need to reproduce Issue that has not been reproduced

Comments

@teemuxyz
Copy link

I'm unable to change the note path. I can enter a new path in the settings, but as soon as I create a new note, or close the Notes app, the setting reverts back to the default path.

Steps to reproduce

  1. Change the notes path setting to "Test"
  2. Close the Notes app
  3. Open the Notes app again and go to the settings -> the notes path setting has reverted back to "Notes"

Or:

  1. Change the notes path setting to "Test"
  2. Create a new note
  3. Go to the Files app to see where the new note has been created -> it's in the "Notes" folder

Expected behaviour

The new setting should stick and new notes should be created in the "Test" folder.

Actual behaviour

As explained above.

Server

Please complete the following information.

  • Notes app version: 4.9.1
  • Nextcloud version: 27.1.2
  • OS: Linux 6.1.0-13-amd64
  • Web server: Apache/2.4.57
  • PHP version: 8.2.7
  • Database: MariaDB 10.11.4

Client

Please complete the following information.

  • Browser (incl. version): tried with Firefox 122.0a1 and Vivaldi 6.5.3206.39
  • OS: Linux 6.5.0-5-amd64

Log files

This is from the browser console when clicking on the notes path text box in the settings:

Content-Security-Policy: The page’s settings blocked the loading of a resource at https://XXXXX/apps/notes/js/notes-commons.js?v=bd34eeaf039b6bffcb57 (“script-src”). notes-main.js:2:4211446

Uncaught (in promise) ChunkLoadError: Loading chunk 351 failed.
(error: https://XXXXX/apps/notes/js/notes-commons.js?v=bd34eeaf039b6bffcb57)
j https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
e https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
e https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
pick https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
onChangeNotePath https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
yn https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
n https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
_wrapper https://XXXXX/apps/notes/js/notes-main.js?v=11bfdcc7-0:2
notes-main.js:2:4211921

@teemuxyz teemuxyz added bug Something isn't working need to reproduce Issue that has not been reproduced labels Dec 19, 2023
@k3tan172

This comment was marked as duplicate.

@rforced

This comment was marked as duplicate.

@Benjamint22
Copy link

For those who really need a temporary workaround until this is fixed, you can update the path by doing the following:

  1. Set the "Notes path" to the desired value (e.g., Path/To/My/Folder).
    • I recommend typing the path in a text editor, copying it, emptying the field, then pasting your value.
  2. Quickly, before the above path automatically gets reset, set "File extensions" to a different value.
  3. Refresh the page.
  4. Open the notes settings again, but this time, set "File extensions" to your desired value (by default, .md).

This works because, upon modifying the value of "File extensions", Nextcloud Notes will send a request to the server to update all the settings to whichever values you set.

@inyourfoss
Copy link

Can confirm the workaround from @Benjamint22 has worked for me.
Will there possiby just be an apply-button next to the field or anything else?
I personally find it hard to guess what or when something is happening, when there is a textfield without some kind of confirmation.
But other than that I am really loving the app. 🙏

@mxuribe
Copy link

mxuribe commented Mar 9, 2024

Also confirm that the work-around from @Benjamint22 worked perfectly!

By the way, as a little bit of input for whomever will review this, prior to trying the work-around, I had tried to make changes via OCC commands (instead of via web gui)...and even THAT failed to work...But its failure was interesting ...Here's what I mean...

I ran the following via the command line in order to make the desired changes to defaults for the Notes app:

sudo -u www-data php /wherever...occ...lives/occ config:app:set notes noteMode --value="preview"
sudo -u www-data php /wherever...occ...lives/occ config:app:set notes fileSuffix --value=".md"
sudo -u www-data php /wherever...occ...lives/occ config:app:set notes defaultFolder --value="my-preferred-folder"

I received "success" sorts of responses. So, then I ran the following command to see what values were actually saved under the Notes' app's config - just you know in case, to verify things:

sudo -u www-data php /wherever...occ...lives/occ config:list notes

Well, the output showed that that my adjustments via the OCC were in fact saved/preserved, and shown in a json format! Meaning that somehow OCC reports that my new desired values are saved...but, the Notes app still did not "see" the new/adjusted values...So, maybe a misconnect between some OCC config and whatever config store the Notes app actually uses?

I would guess the good work-around communicated by @Benjamint22 seems to bypass this bug between OCC and the Notes app's config store...i assume...since the work-around worked for me.

Hoping this minor clue helps any of the Devs in their investigation!
By the way, THANK YOU to all the Devs, maintainers, etc. for all the good work that you all do for this Notes app!!!!!! I love it!

@alaincao
Copy link

Maybe an interesting information to the devs:
when you click the textbox, the javascript's console gives a 404 while trying to fetch
/apps/notes/js/notes-commons.js
My guess is that the correct path should be
/custom_apps/notes/js/notes-commons.js

@OrIOg
Copy link

OrIOg commented Jun 9, 2024

Indeed, the notes-main.js try to fetch notes notes-common.js at "apps/notes" even though it is installed in "custom_apps/notes" in my case.

The other .js files doesn't seem to be a problem as their importation is made directly from the requested page, their resolution point correctly to "custom_apps".
But notes-common.js is fetched from within the notes-main.js.

Wouldn’t the problem then come from the build step? resolving the path wrongly ?


I think a way to reproduce this error is to:

  1. first uninstall "Notes" if present:
  2. edit the config.php in such a way that the "apps" directory isn't writable and give another directory. So setting "apps_paths" to something like that :
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),

and create the directory:
"/var/www/html/custom_apps"

  1. first install "Notes"

@OrIOg
Copy link

OrIOg commented Jun 9, 2024

I was able to fix this issue by adding the next line to the router.js

__webpack_public_path__ = getAppRootUrl("notes") + '/js/';

Don't know if it's a real solution or just a hack. See webpack documentation about it


Just saw the line__webpack_public_path__ = OC.linkTo('notes', 'js/') // eslint-disable-line
in dashboard.js

@joshtrichards
Copy link
Member

joshtrichards commented Aug 8, 2024

@OrIOg Indeed. That seems right (of several variations that should work similarly).

Thanks for looking into this you all. :) I do believe this has since been fixed in the main (dev) branch via 582414f as part of some other work.

Manual backport pending in #1341. Can you test that variation in your environment to make sure it behaves as you'd expect to address this issue?

@joshtrichards joshtrichards linked a pull request Aug 8, 2024 that will close this issue
1 task
@OrIOg
Copy link

OrIOg commented Aug 8, 2024

@joshtrichards

I tested the fix using the branch "stable4.10" on Nextcloud(AIO): 29.0.2.2 with Firefox128.0.3 (64-bit),
and the issue about the script path being wrong is corrected.

We can now change the path.

Although another problem appear, if the used note path doesn't contain the forward-slash at the start so the FilePicker can't load the current selected folder.

It seems to be easily fixed this line:

event.target.value === '' ? '/' : event.target.value, // path

to

event.target.value === '' ? '/' : `/${event.target.value}`, // path

or something equivalent.

Should I create a new issue or make pull-request to fix this referencing this issue ?

@joshtrichards
Copy link
Member

Either fine, but PR preferred. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug Something isn't working need to reproduce Issue that has not been reproduced
Projects
None yet
9 participants