formatting remote sharer should take protocol, path into account
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
bb7e1bdfb7
commit
f3f819b542
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -34,7 +34,7 @@ import escapeHTML from 'escape-html'
|
||||||
* "user@example.com/path/to/owncloud"
|
* "user@example.com/path/to/owncloud"
|
||||||
* "user@anotherexample.com@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.
|
* Initialize the sharing plugin.
|
||||||
|
@ -353,7 +353,8 @@ import escapeHTML from 'escape-html'
|
||||||
*/
|
*/
|
||||||
_formatRemoteShare: function(shareWith, shareWithDisplayName, message) {
|
_formatRemoteShare: function(shareWith, shareWithDisplayName, message) {
|
||||||
var parts = OCA.Sharing.Util._REMOTE_OWNER_REGEXP.exec(shareWith)
|
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
|
// display avatar of the user
|
||||||
var avatar = '<span class="avatar" data-username="' + escapeHTML(shareWith) + '" title="' + message + ' ' + escapeHTML(shareWithDisplayName) + '"></span>'
|
var avatar = '<span class="avatar" data-username="' + escapeHTML(shareWith) + '" title="' + message + ' ' + escapeHTML(shareWithDisplayName) + '"></span>'
|
||||||
var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(shareWithDisplayName) + '</span> '
|
var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(shareWithDisplayName) + '</span> '
|
||||||
|
@ -363,13 +364,15 @@ import escapeHTML from 'escape-html'
|
||||||
var userName = parts[2]
|
var userName = parts[2]
|
||||||
var userDomain = parts[4]
|
var userDomain = parts[4]
|
||||||
var server = parts[5]
|
var server = parts[5]
|
||||||
|
var protocol = parts[6]
|
||||||
|
var serverPath = parts[8] ? parts[7] : ''; // no trailing slash on root
|
||||||
|
|
||||||
var tooltip = message + ' ' + userName
|
var tooltip = message + ' ' + userName
|
||||||
if (userDomain) {
|
if (userDomain) {
|
||||||
tooltip += '@' + userDomain
|
tooltip += '@' + userDomain
|
||||||
}
|
}
|
||||||
if (server) {
|
if (server) {
|
||||||
tooltip += '@' + server
|
tooltip += '@' + server.replace(protocol, '') + serverPath
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '<span class="remoteAddress" title="' + escapeHTML(tooltip) + '">'
|
var html = '<span class="remoteAddress" title="' + escapeHTML(tooltip) + '">'
|
||||||
|
|
Loading…
Reference in New Issue