bookmarks icon indicating copy to clipboard operation
bookmarks copied to clipboard

Uncategorized view

Open bavay opened this issue 7 years ago • 15 comments

With Nextcloud 15.0.7 (and the latest version of the bookmarks app), the "all" and "uncategorized" views contain exactly the same, although I have some bookmarks that I've moved to subfolders (and most of my bookmarks have tags).

As I understand it, only bookmarks that don't belong to a subfolder should end up in "uncategorized".

bavay avatar Apr 11 '19 15:04 bavay

Hey, I sadly cannot reproduce this. Can you check the client side javascript console logs and the nextcloud logs for errors?

marcelklehr avatar Apr 14 '19 21:04 marcelklehr

Hi! here are my nextcloud logs. I have quite a few error messages, even for the default view. I have replaced my user name and IP by placeholders, just in case you'd wonder... nextcloud.log

bavay avatar Apr 17 '19 06:04 bavay

Those errors are unrelated, as far as I can tell. Could you open the client-side javascript console and check the log? Usually that's the F12 key.

marcelklehr avatar Apr 22 '19 22:04 marcelklehr

When loading the default view, this is what I get:

Content Security Policy: Directive ‘child-src’ has been deprecated. Please use directive ‘worker-src’ to control workers, or directive ‘frame-src’ to control frames respectively. JQMIGRATE: Migrate is installed, version 1.4.0 core.js:7:542 New search handler registered search.js:67:4 Loaded script with known vulnerabilities: https://XXXX/core/vendor/core.js?v=0fd94d96-21

  • jquery 2.1.4 - Info: https://github.com/jquery/jquery/issues/2432 http://blog.jquery.com/2016/01/08/jquery-2-2-and-1-12-released/ https://nvd.nist.gov/vuln/detail/CVE-2015-9251 http://research.insecurelabs.org/jquery/test/ https://bugs.jquery.com/ticket/11974 https://nvd.nist.gov/vuln/detail/CVE-2015-9251 http://research.insecurelabs.org/jquery/test/ https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/ https://nvd.nist.gov/vuln/detail/CVE-2019-11358 https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b
  • jquery-migrate 1.4.0 - Info:
  • jquery-ui-dialog 1.10.0 - Info: https://github.com/jquery/api.jqueryui.com/issues/281 https://nvd.nist.gov/vuln/detail/CVE-2016-7103 https://snyk.io/vuln/npm:jquery-ui:20160721
  • jquery-ui-autocomplete 1.10.0 - Info:
  • jquery-ui-tooltip 1.10.0 - Info:
  • backbone.js 1.2.3 - Info:
  • handlebars.js 4.0.5 - Info: https://snyk.io/vuln/SNYK-JS-HANDLEBARS-173692 https://github.com/wycats/handlebars.js/commit/7372d4e9dffc9d70c09671aa28b9392a1577fd86 https://snyk.io/vuln/SNYK-JS-HANDLEBARS-174183 https://github.com/wycats/handlebars.js/issues/1495 https://github.com/wycats/handlebars.js/commit/cd38583216dce3252831916323202749431c773e
  • DOMPurify 1.0.4 - Info:
  • moment.js 2.18.1 - Info: content.js:19:5 Loaded script with known vulnerabilities: https://XXXX/apps/bookmarks/js/dist/main.bundle.js?v=0fd94d96-21
  • jquery 3.3.1 - Info: https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/ https://nvd.nist.gov/vuln/detail/CVE-2019-11358 https://github.com/jquery/jquery/commit/753d591aea698e57d6db58c9f722cd0808619b1b
  • backbone.js 1.3.3 - Info: content.js:19:5 Source map error: TypeError: NetworkError when attempting to fetch resource. Resource URL: https://XXXX/apps/bookmarks/js/dist/main.bundle.js?v=0fd94d96-21 Source Map URL: ./backbone.radio.js.map[Learn More]

After clicking on "Uncategorized", I don't get any other logs... Could the fetch error be the problem? ​

bavay avatar Apr 24 '19 09:04 bavay

Source map error: TypeError: NetworkError when attempting to fetch resource.

This is unlikely to be the problem.

marcelklehr avatar Apr 24 '19 15:04 marcelklehr

Could you send me a database dump of the oc_bookmarks_folders_bookmarks table?

marcelklehr avatar Apr 24 '19 20:04 marcelklehr

I have the same problem with the categories.

I did some digging in the database and some testing. Whenever I "move" a bookmark via the web ui from a folder wether from the folder ungategorized with id -1 or an self created folder then the bookmark entry doesn't change in the table oc_bookmarks_folder_bookmarks. Insted of changig an second entry will be added with the same bookmark_id but different folder_id.

So when i repeatedly "move" a bookmark via the web ui I end up with the same amount of entries for a particular bookmark in the table oc_bookmark_folder_bookmarks. Insted of moving I dublicate the bookmark folder entry.

I hope this description is helpful.

Vantome avatar Apr 26 '19 09:04 Vantome

This is exactly what I suspected. I cannot reproduce this off-hand, though. Which browser are you using?

marcelklehr avatar Apr 26 '19 11:04 marcelklehr

Sorry, I did not provide my db dump (debugging some things on my server, making it totally unusable). On my side, I am using Firefox 66.0.3 on Linux.

bavay avatar Apr 26 '19 12:04 bavay

I have this beavior with Firefox 66.0.3 and Chrome 74.0.3729.108 on Windows 10 as well as with Safari 12.1 and Firefox 66.0.3 on macOS Mojave.

Vantome avatar Apr 26 '19 12:04 Vantome

Hi.

I also have this problem, and inspected it a little and found some things which I added as comments below.

  • In js/apps/MainRouter.js:32

    		folder: function(folderId) {
    			this.app.bookmarks.setFetchQuery({ folder: folderId }); // folderId is a string coming from the router
    			this.app.bookmarks.fetchPage();
    			Radio.channel('nav').trigger('navigate', 'folder', folderId);
    		},
    
  • In js/models/Bookmarks.js:21

    	setFetchQuery: function(data) {
    		this.loadingState.set({
    			page: 0,
    			query: data, // data is { folder: "<folder id>" }
    			fetching: false,
    			reachedEnd: false
    		});
    		this.abortCurrentRequest();
    	},
    
  • In js/views/Folder.js:231

    	moveBookmark: function(bm) {
    		var that = this;
    		var folders = bm.get('folders'), // this is a list of numbers
    			isInsideFolder =
    				'undefined' !==
    				typeof this.app.bookmarks.loadingState.get('query').folder; // the string set in setFetchQuery
    		if (isInsideFolder) {
    			if (
    				this.app.bookmarks.loadingState.get('query').folder === // same as above
    				this.model.get('id') // returns a number
    			) {
    				return;
    			}
    			folders = _.without(
    				folders, // the list of numbers from above
    				this.app.bookmarks.loadingState.get('query').folder // again, a string
    			);
    		}
    		folders.push(this.model.get('id'));
    		bm.set('folders', folders);
    		if (isInsideFolder) {
    			bm.once('sync', function() {
    				that.app.bookmarks.remove(bm);
    			});
    		}
    		bm.save();
    },
    

By changing the line

this.app.bookmarks.setFetchQuery({ folder: folderId });

to

this.app.bookmarks.setFetchQuery({ folder: Number(folderId) });

it seems to work, but I don't know if it might affect other things.

jpumc avatar May 02 '19 19:05 jpumc

aha. I've seen an incarnation of this problem before. You're running postgres?

@jpumc Thanks for taking the time to debug this! :blue_heart:

marcelklehr avatar May 02 '19 20:05 marcelklehr

Fixed by 426a355221db0eda1341cdd58b

marcelklehr avatar May 02 '19 21:05 marcelklehr

@marcelklehr I am using Bookmarks 1.0.6 (which contains the commit 426a355) with NextCloud 16.0.2 and I still see this issue. I am also using PG.

jpmv27 avatar Jul 05 '19 21:07 jpmv27

@marcelklehr I did not realize that the fix does not work retroactively. I manually reclassified all my bookmarks into their same categories/folders and now everything is working as expected. Sorry for the noise. And thanks for the fix!

jpmv27 avatar Jul 05 '19 22:07 jpmv27