mirror of https://gitlab.com/bashrc2/epicyon
Media path same as mastodon
parent
6a9cd38912
commit
dccb22c393
|
@ -13229,6 +13229,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# show media
|
# show media
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
|
# replace mastoson-style media path
|
||||||
|
if '/system/media_attachments/files/' in self.path:
|
||||||
|
self.path = self.path.replace('/system/media_attachments/files/',
|
||||||
|
'/media/')
|
||||||
if '/media/' in self.path:
|
if '/media/' in self.path:
|
||||||
self._showMedia(callingDomain,
|
self._showMedia(callingDomain,
|
||||||
self.path, self.server.baseDir,
|
self.path, self.server.baseDir,
|
||||||
|
|
2
media.py
2
media.py
|
@ -325,6 +325,8 @@ def attachMedia(baseDir: str, httpPrefix: str,
|
||||||
createMediaDirs(baseDir, mPath)
|
createMediaDirs(baseDir, mPath)
|
||||||
mediaFilename = baseDir + '/' + mediaPath
|
mediaFilename = baseDir + '/' + mediaPath
|
||||||
|
|
||||||
|
mediaPath = \
|
||||||
|
mediaPath.replace('media/', 'system/media_attachments/files/', 1)
|
||||||
attachmentJson = {
|
attachmentJson = {
|
||||||
'mediaType': mediaType,
|
'mediaType': mediaType,
|
||||||
'name': description,
|
'name': description,
|
||||||
|
|
|
@ -337,6 +337,10 @@ def postMessageToOutbox(session, translate: {},
|
||||||
# change the url of the attachment
|
# change the url of the attachment
|
||||||
attach['url'] = \
|
attach['url'] = \
|
||||||
httpPrefix + '://' + domainFull + '/' + mediaPath
|
httpPrefix + '://' + domainFull + '/' + mediaPath
|
||||||
|
attach['url'] = \
|
||||||
|
attach['url'].replace('/media/',
|
||||||
|
'/system/' +
|
||||||
|
'media_attachments/files/')
|
||||||
|
|
||||||
permittedOutboxTypes = ('Create', 'Announce', 'Like', 'Follow', 'Undo',
|
permittedOutboxTypes = ('Create', 'Announce', 'Like', 'Follow', 'Undo',
|
||||||
'Update', 'Add', 'Remove', 'Block', 'Delete',
|
'Update', 'Add', 'Remove', 'Block', 'Delete',
|
||||||
|
|
4
tests.py
4
tests.py
|
@ -1299,7 +1299,9 @@ def testPostMessageBetweenServers(baseDir: str) -> None:
|
||||||
assert attached.get('type')
|
assert attached.get('type')
|
||||||
assert attached.get('url')
|
assert attached.get('url')
|
||||||
assert attached['mediaType'] == 'image/png'
|
assert attached['mediaType'] == 'image/png'
|
||||||
assert '/media/' in attached['url']
|
if not '/system/media_attachments/files/' in attached['url']:
|
||||||
|
print(attached['url'])
|
||||||
|
assert '/system/media_attachments/files/' in attached['url']
|
||||||
assert attached['url'].endswith('.png')
|
assert attached['url'].endswith('.png')
|
||||||
assert attached.get('width')
|
assert attached.get('width')
|
||||||
assert attached.get('height')
|
assert attached.get('height')
|
||||||
|
|
Loading…
Reference in New Issue