Syncthing: api: /rest/system/browse behaves strangely on Windows

Created on 27 May 2016  路  3Comments  路  Source: syncthing/syncthing

Version Information

Syncthing Version: v0.13.4
OS Version: Windows 10 / Windows (64 bit)

What happened:

URL: http://127.0.0.1:8384/rest/system/browse?
RESPONSE: ["etc\\","extra\\","metadata\\"]
EXPECTED: a list of drives?
BUG: it presents the contents of the Syncthing executable folder

URL: http://127.0.0.1:8384/rest/system/browse?current=C:%5C (5C = backslash)
RESPONSE: ["C:etc\\","C:extra\\","C:metadata\\"]
EXPECTED: contents of C:\ root folder
BUG: it presents the contents of the Syncthing executable folder, but with C: prepended

URL: http://127.0.0.1:8384/rest/system/browse?current=C:%2F (2F = forwardslash)
RESPONSE: ["C:etc\\","C:extra\\","C:metadata\\"]
EXPECTED: contents of C:\ root folder
BUG: it presents the contents of the Syncthing executable folder, but with C: prepended

URL: http://127.0.0.1:8384/rest/system/browse?current=G:%5C
RESPONSE: ["G:$RECYCLE.BIN\\","G:Steam\\","G:System Volume Information\\"]
EXPECTED: ["G:\\$RECYCLE.BIN\\","G:\\Steam\\","G:\\System Volume Information\\"]
BUG: it is missing the escaped backslash between the drive and folder name. This happens for all drive root folders, going one folder deeper and it returns the correct full paths.

Summary

  • /rest/system/browse api calls to all drive folders on Windows are missing an escaped backslash between the drive and folder name.
  • /rest/system/browse calls to C:\ in any form return as if they were the Syncthing exe folder.

    Screenshots

Double clicking in the Folder Path field produces:
untitled

Why

I would like this fixed so that I can then attempt https://github.com/syncthing/syncthing/issues/2958 with https://www.jstree.com/demo/

bug frozen-due-to-age

All 3 comments

This is an issue upstream:

https://github.com/golang/go/issues/15863

As a workaround for Windows, just use double slashes until we fix it.

yes good, http://127.0.0.1:8384/rest/system/browse?current=C:%5C%5C looks like it returns the contents properly. Thanks.

Once that golang bug is fixed, will http://127.0.0.1:8384/rest/system/browse? return the list of drives?

Given you are interested in spending time on this, assume that yes, no arguments will return th drives available.

I'll produce the code shortly.

Was this page helpful?
0 / 5 - 0 ratings