aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-07-10 10:47:37 -0100
committerMaxence Lange <maxence@artificial-owl.com>2023-07-11 09:25:09 -0100
commit3b93a3510811982d31cda8a023a77336bd0fb0a9 (patch)
treebbdb1abfcaddfdeae4d6fc87f7581f253b3c5c77 /lib
parentb43e45d3c2dabd573a5a519ea96b6a33f38fe759 (diff)
downloadnextcloud-server-3b93a3510811982d31cda8a023a77336bd0fb0a9.tar.gz
nextcloud-server-3b93a3510811982d31cda8a023a77336bd0fb0a9.zip
display displayname on federated shares
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Federation/CloudIdManager.php11
-rw-r--r--lib/public/Federation/ICloudIdManager.php10
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php
index 85aae8e5ec5..82b711bd422 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) {
- if (strpos($url, 'https://') === 0) {
- return substr($url, strlen('https://'));
- } elseif (strpos($url, 'http://') === 0) {
- return substr($url, strlen('http://'));
+ public function removeProtocolFromUrl(string $url): string {
+ if (str_starts_with($url, 'https://')) {
+ 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;
}