Merge pull request #24392 from nextcloud/backport/24375/stable19

[stable19] formatting remote sharer should take protocol, path into account
This commit is contained in:
blizzz 2020-11-26 22:12:53 +01:00 committed by GitHub
commit 5a4e066ec2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 122 additions and 119 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,7 @@
* "user@example.com/path/to/owncloud"
* "user@anotherexample.com@example.com/path/to/owncloud
*/
_REMOTE_OWNER_REGEXP: new RegExp('^(([^@]*)@(([^@^/^\\s]*)@)?)([^[\\s/]*)([/](.*))?$'),
_REMOTE_OWNER_REGEXP: new RegExp('^(([^@]*)@(([^@^/\\s]*)@)?)((https://)?[^[\\s/]*)([/](.*))?$'),
/**
* Initialize the sharing plugin.
@ -351,7 +351,8 @@
*/
_formatRemoteShare: function(shareWith, shareWithDisplayName, message) {
var parts = OCA.Sharing.Util._REMOTE_OWNER_REGEXP.exec(shareWith)
if (!parts || !parts[6]) {
console.error(parts);
if (!parts || !parts[7]) {
// display avatar of the user
var avatar = '<span class="avatar" data-username="' + escapeHTML(shareWith) + '" title="' + message + ' ' + escapeHTML(shareWithDisplayName) + '"></span>'
var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(shareWithDisplayName) + '</span> '
@ -361,13 +362,15 @@
var userName = parts[2]
var userDomain = parts[4]
var server = parts[5]
var protocol = parts[6]
var serverPath = parts[8] ? parts[7] : ''; // no trailing slash on root
var tooltip = message + ' ' + userName
if (userDomain) {
tooltip += '@' + userDomain
}
if (server) {
tooltip += '@' + server
tooltip += '@' + server.replace(protocol, '') + serverPath
}
var html = '<span class="remoteAddress" title="' + escapeHTML(tooltip) + '">'