Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Django Private Storage
Commits
7e02c9e9
Unverified
Commit
7e02c9e9
authored
May 15, 2023
by
Diederik van der Boor
Browse files
Perform f-string updates using py-upgrade
parent
d4c0c7bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
private_storage/models.py
View file @
7e02c9e9
...
...
@@ -16,7 +16,7 @@ class PrivateFile:
self
.
parent_object
=
parent_object
def
__repr__
(
self
):
return
'<PrivateFile: {
}>'
.
format
(
self
.
relative_name
)
return
f
'<PrivateFile:
{
self
.
relative_name
}
>'
@
cached_property
def
full_path
(
self
):
...
...
private_storage/servers.py
View file @
7e02c9e9
...
...
@@ -16,7 +16,7 @@ from django.utils.module_loading import import_string
from
django.views.static
import
serve
,
was_modified_since
@
lru_cache
()
@
lru_cache
def
get_server_class
(
path
):
if
'.'
in
path
:
return
import_string
(
path
)
...
...
private_storage/views.py
View file @
7e02c9e9
...
...
@@ -126,17 +126,17 @@ class PrivateStorageView(View):
if
'WebKit'
in
user_agent
:
# Support available for UTF-8 encoded strings.
# This also matches Edgee.
return
'filename={
}'
.
format
(
filename
)
.
encode
(
"utf-8"
)
return
f
'filename=
{
filename
}
'
.
encode
(
"utf-8"
)
elif
'MSIE'
in
user_agent
:
# IE does not support RFC2231 for internationalized headers, but somehow
# percent-decodes it so this can be used instead. Note that using the word
# "attachment" anywhere in the filename overrides an inline content-disposition.
url_encoded
=
quote
(
filename
.
encode
(
"utf-8"
)).
replace
(
'attachment'
,
"a%74tachment"
)
return
"filename={
}"
.
format
(
url_encoded
)
.
encode
(
"utf-8"
)
return
f
"filename=
{
url_encoded
}
"
.
encode
(
"utf-8"
)
else
:
# For others like Firefox, we follow RFC2231 (encoding extension in HTTP headers).
rfc2231_filename
=
quote
(
filename
.
encode
(
"utf-8"
))
return
"filename*=UTF-8''{
}"
.
format
(
rfc2231_filename
)
.
encode
(
"utf-8"
)
return
f
"filename*=UTF-8''
{
rfc2231_filename
}
"
.
encode
(
"utf-8"
)
class
PrivateStorageDetailView
(
SingleObjectMixin
,
PrivateStorageView
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment