diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2023-06-28 09:27:55 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2023-06-28 09:28:03 -0100 |
commit | d2efd0e03cb0f30b748b86c324fc574e603334aa (patch) | |
tree | 573612743cd7e60ad8f14b1426ef7735cdae7617 /lib | |
parent | 266436b76788d14e061bbe1f013bc052edc8041f (diff) | |
download | nextcloud-server-d2efd0e03cb0f30b748b86c324fc574e603334aa.tar.gz nextcloud-server-d2efd0e03cb0f30b748b86c324fc574e603334aa.zip |
displayname on federated shares
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Federation/CloudIdManager.php | 9 | ||||
-rw-r--r-- | lib/public/Federation/ICloudIdManager.php | 10 |
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 01e00c01181..22b06af386f 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -209,11 +209,12 @@ class CloudIdManager implements ICloudIdManager { * @param string $url * @return string */ - private function removeProtocolFromUrl($url) { + public function removeProtocolFromUrl(string $url): string { if (str_starts_with($url, 'https://')) { - return substr($url, strlen('https://')); - } elseif (str_starts_with($url, 'http://')) { - return substr($url, strlen('http://')); + return substr($url, 8); + } + if (str_starts_with($url, 'http://')) { + return substr($url, 7); } return $url; diff --git a/lib/public/Federation/ICloudIdManager.php b/lib/public/Federation/ICloudIdManager.php index 1612c03ba4a..52920751739 100644 --- a/lib/public/Federation/ICloudIdManager.php +++ b/lib/public/Federation/ICloudIdManager.php @@ -62,4 +62,14 @@ interface ICloudIdManager { * @since 12.0.0 */ public function isValidCloudId(string $cloudId): bool; + + /** + * remove scheme/protocol from an url + * + * @param string $url + * + * @return string + * @since 28.0.0 + */ + public function removeProtocolFromUrl(string $url): string; } |