Support for contact uri that aren't HTTP URLs
This commit is contained in:
parent
b5a1f13d7c
commit
dfaa4b89c7
3 changed files with 6 additions and 6 deletions
|
@ -92,7 +92,7 @@ class Avatar
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = self::getFilename($contact['url']);
|
$filename = self::getFilename($contact['url'], $avatar);
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
|
|
||||||
$fields['blurhash'] = $image->getBlurHash();
|
$fields['blurhash'] = $image->getBlurHash();
|
||||||
|
@ -120,7 +120,7 @@ class Avatar
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = self::getFilename($contact['url']);
|
$filename = self::getFilename($contact['url'], $contact['avatar']);
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
|
|
||||||
$fields['photo'] = self::storeAvatarCache($image, $filename, Proxy::PIXEL_SMALL, $timestamp);
|
$fields['photo'] = self::storeAvatarCache($image, $filename, Proxy::PIXEL_SMALL, $timestamp);
|
||||||
|
@ -130,9 +130,9 @@ class Avatar
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getFilename(string $url): string
|
private static function getFilename(string $url, string $host): string
|
||||||
{
|
{
|
||||||
$guid = Item::guidFromUri($url);
|
$guid = Item::guidFromUri($url, $host);
|
||||||
|
|
||||||
return substr($guid, 0, 2) . '/' . substr($guid, 3, 2) . '/' . substr($guid, 5, 3) . '/' .
|
return substr($guid, 0, 2) . '/' . substr($guid, 3, 2) . '/' . substr($guid, 5, 3) . '/' .
|
||||||
substr($guid, 9, 2) .'/' . substr($guid, 11, 2) . '/' . substr($guid, 13, 4). '/' . substr($guid, 18) . '-';
|
substr($guid, 9, 2) .'/' . substr($guid, 11, 2) . '/' . substr($guid, 13, 4). '/' . substr($guid, 18) . '-';
|
||||||
|
|
|
@ -2773,7 +2773,7 @@ class Contact
|
||||||
}
|
}
|
||||||
|
|
||||||
$update = false;
|
$update = false;
|
||||||
$guid = ($ret['guid'] ?? '') ?: Item::guidFromUri($ret['url']);
|
$guid = ($ret['guid'] ?? '') ?: Item::guidFromUri($ret['url'], $ret['baseurl'] ?: $ret['alias']);
|
||||||
|
|
||||||
// make sure to not overwrite existing values with blank entries except some technical fields
|
// make sure to not overwrite existing values with blank entries except some technical fields
|
||||||
$keep = ['batch', 'notify', 'poll', 'request', 'confirm', 'poco', 'baseurl'];
|
$keep = ['batch', 'notify', 'poll', 'request', 'confirm', 'poco', 'baseurl'];
|
||||||
|
|
|
@ -2044,7 +2044,7 @@ class Item
|
||||||
// Remove the scheme to make sure that "https" and "http" doesn't make a difference
|
// Remove the scheme to make sure that "https" and "http" doesn't make a difference
|
||||||
unset($parsed['scheme']);
|
unset($parsed['scheme']);
|
||||||
|
|
||||||
$hostPart = $host ?? $parsed['host'] ?? '';
|
$hostPart = $host ?: $parsed['host'] ?? '';
|
||||||
if (!$hostPart) {
|
if (!$hostPart) {
|
||||||
Logger::warning('Empty host GUID part', ['uri' => $uri, 'host' => $host, 'parsed' => $parsed, 'callstack' => System::callstack(10)]);
|
Logger::warning('Empty host GUID part', ['uri' => $uri, 'host' => $host, 'parsed' => $parsed, 'callstack' => System::callstack(10)]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue