Server: Dollar sign in SMB external storage not supported anymore

Created on 16 May 2019  路  14Comments  路  Source: nextcloud/server

After updating from v15 to v16, my SMB storages with a dollar sign in the configuration name (useful to hide shares in a Windows network) doesn't work anymore. If I rename with share without the dollar sign it works

_EDIT: The bug is just on the home page of the file app; if I try to access the storage with /?dir=myshare in the URL it works_

Steps to reproduce

  1. Configure a SMB storage with a dollar in the name
  2. Go to file app

Expected behaviour

I should be able to click on the share and access its files

Actual behaviour

The share name is red and when I click on it I have an error message: "Mount configuration incomplete. Do you want to review mount point config in admin settings page?"
In the admin logs I have this error: "A placeholder was not substituted: myshare$ for mount type \OCA\Files_External\Lib\Storage\SMB"

Server configuration

Docker image nextcloud:16

0. Needs triage bug regression

All 14 comments

I have the same issue. Shares worked fine in 15.0.7. Updated to 16.0.1 tonight and my private share is inaccessible because of the $

I have the sam issue. update 15.0.6 -> 16.0.1
double check mountpoint with and without $ and it is the $

Same issues after updating from 15.0.6 to 16.0.1

Looks like a regression from https://github.com/nextcloud/server/pull/14174

There is a check if all placeholders for external storage configuration is replaced. A placeholder starts with an $. If your share name ends with $ the configuration looks incomplete. The patch below allows $ as last character (a hidden share always ends with $ right?)

Index: apps/files_external/lib/config.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- apps/files_external/lib/config.php  (revision a3b4410283a0517b458deacc8ee704c12ec028bd)
+++ apps/files_external/lib/config.php  (date 1558130442000)
@@ -292,7 +292,7 @@
                }
            }
        } else if (is_string($option)) {
-           if (strpos($option, '$') !== false) {
+           if (strpos(rtrim($option, '$'), '$') !== false) {
                $result = false;
            }
        }


cc @blizzz you better know if the patch is acceptable. Not sure if this works well with ldap ;)

@kesselb yes, that looks fine from my point of view! In LDAP we just introduce another placeholder.

Would be awesome if someone could confirm :

a hidden share always ends with $ right?

Updated the patch. I forgot about rtrim ;)

@kesselb yes, that looks fine from my point of view! In LDAP we just introduce another placeholder.

Would be awesome if someone could confirm :

a hidden share always ends with $ right?

Yes that's the only way to configure a hidden share.

I confirm the fix is working, my shares are back on tracks, thanks !

@rainbob5 superb, thanks for the feedback.

@kesselb mind opening the PR then?

Thanks, Fixed my issue on 16.0.1

public static function arePlaceholdersSubstituted($option):bool {
                $result = true;
                if(is_array($option)) {
                        foreach ($option as $optionItem) {
                                if(is_array($optionItem)) {
                                        $result = $result && self::arePlaceholdersSubstituted($option);
                                }
                        }
                } else if (is_string($option)) {
                        if (strpos($option, '$') !== false) {
                        if (strpos(rtrim($option, '$'), '$') !== false) {
                                $result = false;}
                        }
                }
                return $result;
        }

So hav the whol block to look.

if (strpos(rtrim($option, '$'), '$') !== false) {
                $result = false; 

needs an closing }

Please use https://help.github.com/en/articles/creating-and-highlighting-code-blocks to share code blocks. There is already a pull request for this issue: https://github.com/nextcloud/server/pull/15637

@kesselb
Thx for the link, did not know how to :-)

worked for me as well! (16.0.3)

thank you for sharing this with us! *thumbsup

Thank You!
This patch resolved the issue on our server 16.0.3 on Ubuntu 18.04.1
However it did not fix opening documents in Collabora on hidden share.
We are using a share like this \\Server\Users$\$user\
(Hidden share with login name variable)
I have no idea if this is related or not.
Clicking on a document gives this message:

Failed to read document from storage. Please contact your storage server (nextcloud.domain.com) administrator.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juliushaertl picture juliushaertl  路  3Comments

ChristophWurst picture ChristophWurst  路  3Comments

williambargent picture williambargent  路  3Comments

georgehrke picture georgehrke  路  3Comments

mama21mama picture mama21mama  路  3Comments