-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add file storage #1361
base: main
Are you sure you want to change the base?
add file storage #1361
Conversation
def __call__(self, request): | ||
response = self.get_response(request) | ||
if ( | ||
request.get_host() == urlsplit(settings.GET_USERCONTENT_URL()).netloc | ||
and request.resolver_match.url_name != "document" | ||
): | ||
return redirect(urljoin(settings.GET_SITE_URL(), request.path)) | ||
return response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do exactly? (Needs a comment)
Also, am I right to think this is specific to the documents plugin and wouldn't work to deliver e.g. custom logos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good point. We could move the list of "media views" to the settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand what it does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you request the usercontent domain, but on a view that does not serve usercontent (e.g. ephiosusercontent.de/accounts/login), it will redirect you to the same view but on the regular domain. This prevents the app from being served under the content domain, and therefore on the same domain as the usercontent
response = HttpResponse() | ||
response["X-Accel-Redirect"] = document.file.url | ||
response["Content-Disposition"] = ( | ||
"attachment; filename=" + os.path.split(document.file.name)[1] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need a comment as well. Maybe we can craft this into an AcceleratedMediaResponse
class to make it reusable?
closes #504