Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
3d2acc93
Commit
3d2acc93
authored
4 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Return a 404 if we don't have the original file
parent
2d577283
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/rest/media/v1/media_storage.py
+1
-1
1 addition, 1 deletion
synapse/rest/media/v1/media_storage.py
synapse/rest/media/v1/thumbnail_resource.py
+7
-0
7 additions, 0 deletions
synapse/rest/media/v1/thumbnail_resource.py
with
8 additions
and
1 deletion
synapse/rest/media/v1/media_storage.py
+
1
−
1
View file @
3d2acc93
...
@@ -244,7 +244,7 @@ class MediaStorage:
...
@@ -244,7 +244,7 @@ class MediaStorage:
await
consumer
.
wait
()
await
consumer
.
wait
()
return
local_path
return
local_path
raise
Exception
(
"
file could not be found
"
)
raise
NotFoundError
(
)
def
_file_info_to_path
(
self
,
file_info
:
FileInfo
)
->
str
:
def
_file_info_to_path
(
self
,
file_info
:
FileInfo
)
->
str
:
"""
Converts file_info into a relative path.
"""
Converts file_info into a relative path.
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/media/v1/thumbnail_resource.py
+
7
−
0
View file @
3d2acc93
...
@@ -340,6 +340,13 @@ class ThumbnailResource(DirectServeJsonResource):
...
@@ -340,6 +340,13 @@ class ThumbnailResource(DirectServeJsonResource):
# width/height/method so we can just call the "generate exact"
# width/height/method so we can just call the "generate exact"
# methods.
# methods.
# First let's check that we do actually have the original image
# still. This will throw a 404 if we don't.
# TODO: We should refetch the thumbnails for remote media.
await
self
.
media_storage
.
ensure_media_is_in_local_cache
(
FileInfo
(
server_name
,
file_id
,
url_cache
=
url_cache
)
)
if
server_name
:
if
server_name
:
await
self
.
media_repo
.
generate_remote_exact_thumbnail
(
await
self
.
media_repo
.
generate_remote_exact_thumbnail
(
server_name
,
server_name
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment