Repository: syncthing/syncthing (language: go)

Issue:
Tildes break directory autocomplete
### What happened?

When you go to create a new folder and use `~` as a shortcut for your home directory, autocomplete stops working.

Here's what it looks like with `~` (there is no autocomplete):
![Image](https://github.com/user-attachments/assets/557ab5bf-7948-44c0-a991-d047826b593d)

And with `/home/marcus` (real path of my home directory):

![Image](https://github.com/user-attachments/assets/da06aed5-b76d-49f4-a686-b2b7422cdb98)

This behavior (paired with the log output) is strange, as calling the REST API directly through curl with tildes behaves correctly and lists everything in my home directory.

### Syncthing version

v1.29.3

### Platform & operating system

(Arch, with all optional repositories enabled) Linux (64-bit AMD)

### Browser version

LibreWolf 136.0.1

### Relevant log output

```shell
2025-03-14 10:24:45 http: GET "/rest/system/browse?current=%2Fhome%2Fmarcus%2F": status 200, 1473 bytes in 0.94 ms
2025-03-14 10:26:21 http: GET "/rest/svc/random/string?length=10": status 200, 29 bytes in 0.13 ms
2025-03-14 10:26:21 http: GET "/rest/config/defaults/folder": status 200, 1361 bytes in 0.16 ms
2025-03-14 10:26:23 http: GET "/rest/system/browse?current=~": status 200, 21 bytes in 0.21 ms
2025-03-14 10:26:24 http: GET "/rest/system/browse?current=~%2F": status 200, 1473 bytes in 1.10 ms
```


Discussion / hints:

Fix patch:
diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json
index b30c3599784..e58b799e637 100644
--- a/gui/default/assets/lang/lang-en.json
+++ b/gui/default/assets/lang/lang-en.json
@@ -27,6 +27,7 @@
     "Allowed Networks": "Allowed Networks",
     "Alphabetic": "Alphabetic",
     "Altered by ignoring deletes.": "Altered by ignoring deletes.",
+    "Always turned on when the folder type is \"{%foldertype%}\".": "Always turned on when the folder type is \"{{foldertype}}\".",
     "An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.": "An external command handles the versioning. It has to remove the file from the shared folder. If the path to the application contains spaces, it should be quoted.",
     "Anonymous Usage Reporting": "Anonymous Usage Reporting",
     "Anonymous usage report format has changed. Would you like to move to the new format?": "Anonymous usage report format has changed. Would you like to move to the new format?",
@@ -52,6 +53,7 @@
     "Body:": "Body:",
     "Bugs": "Bugs",
     "Cancel": "Cancel",
+    "Cannot be enabled when the folder type is \"{%foldertype%}\".": "Cannot be enabled when the folder type is \"{{foldertype}}\".",
     "Changelog": "Changelog",
     "Clean out after": "Clean out after",
     "Cleaning Versions": "Cleaning Versions",
diff --git a/gui/default/syncthing/folder/editFolderModalView.html b/gui/default/syncthing/folder/editFolderModalView.html
index 696f143a23a..5930b8f0582 100644
--- a/gui/default/syncthing/folder/editFolderModalView.html
+++ b/gui/default/syncthing/folder/editFolderModalView.html
@@ -251,6 +251,9 @@
               <select class="form-control" ng-if="currentFolder.type == 'sendonly'" disabled>
                 <option value="disabled" translate>Disabled</option>
               </select>
+              <p class="help-block" ng-if="currentFolder.type === 'sendonly'" translate translate-value-foldertype="{{'Send Only' | translate}}">
+                Cannot be enabled when the folder type is "{%foldertype%}".
+              </p>
             </div>
           </div>
 
@@ -282,6 +285,9 @@
               <p translate class="help-block">
                 Disables comparing and syncing file permissions. Useful on systems with nonexistent or custom permissions (e.g. FAT, exFAT, Synology, Android).
               </p>
+              <p class="help-block" ng-if="currentFolder._recvEnc" translate translate-value-foldertype="{{'Receive Encrypted' | translate}}">
+                Always turned on when the folder type is "{%foldertype%}".
+              </p>
             </div>
           </div>
 
@@ -297,12 +303,18 @@
               <p translate class="help-block">
                 Enables sending ownership information to other devices, and applying incoming ownership information. Typically requires running with elevated privileges.
               </p>
+              <p class="help-block" ng-if="has(['sendonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'sendonly' ? ('Send Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
+                Cannot be enabled when the folder type is "{%foldertype%}".
+              </p>
               <label>
                 <input type="checkbox" ng-disabled="currentFolder.type == 'receiveonly' || currentFolder.type == 'receiveencrypted' || currentFolder.syncOwnership" ng-checked="currentFolder.sendOwnership || currentFolder.syncOwnership" ng-model="currentFolder.sendOwnership" /> <span translate>Send Ownership</span>
               </label>
               <p translate class="help-block">
                 Enables sending ownership information to other devices, but not applying incoming ownership information. This can have a significant performance impact. Always enabled when "Sync Ownership" is enabled.
               </p>
+              <p class="help-block" ng-if="has(['receiveonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'receiveonly' ? ('Receive Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
+                Cannot be enabled when the folder type is "{%foldertype%}".
+              </p>
             </div>
             <div class="col-md-6 form-group">
               <p>
@@ -315,12 +327,18 @@
               <p translate class="help-block">
                 Enables sending extended attributes to other devices, and applying incoming extended attributes. May require running with elevated privileges.
               </p>
+              <p class="help-block" ng-if="has(['sendonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'sendonly' ? ('Send Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
+                Cannot be enabled when the folder type is "{%foldertype%}".
+              </p>
               <label>
                 <input type="checkbox" ng-disabled="currentFolder.type == 'receiveonly' || currentFolder.type == 'receiveencrypted' || currentFolder.syncXattrs" ng-checked="currentFolder.sendXattrs || currentFolder.syncXattrs" ng-model="currentFolder.sendXattrs" /> <span translate>Send Extended Attributes</span>
               </label>
               <p translate class="help-block">
                 Enables sending extended attributes to other devices, but not applying incoming extended attributes. This can have a significant performance impact. Always enabled when "Sync Extended Attributes" is enabled.
               </p>
+              <p class="help-block" ng-if="has(['receiveonly', 'receiveencrypted'], currentFolder.type)" translate translate-value-foldertype="{{currentFolder.type === 'receiveonly' ? ('Receive Only' | translate) : currentFolder.type === 'receiveencrypted' ? ('Receive Encrypted' | translate) : ''}}">
+                Cannot be enabled when the folder type is "{%foldertype%}".
+              </p>
             </div>
           </div>
 


Test patch: