Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LibreTranslate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Riße, Matthias
LibreTranslate
Commits
5f2d0435
Unverified
Commit
5f2d0435
authored
3 years ago
by
Sébastien Thuret
Browse files
Options
Downloads
Patches
Plain Diff
change tmp dir
parent
8d5a418b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/app.py
+5
-2
5 additions, 2 deletions
app/app.py
with
5 additions
and
2 deletions
app/app.py
+
5
−
2
View file @
5f2d0435
...
@@ -19,6 +19,9 @@ from .api_keys import Database
...
@@ -19,6 +19,9 @@ from .api_keys import Database
from
.suggestions
import
Database
as
SuggestionsDatabase
from
.suggestions
import
Database
as
SuggestionsDatabase
def
get_upload_dir
():
return
os
.
path
.
join
(
tempfile
.
gettempdir
(),
"
libretranslate-files-translate
"
)
def
get_json_dict
(
request
):
def
get_json_dict
(
request
):
d
=
request
.
get_json
()
d
=
request
.
get_json
()
if
not
isinstance
(
d
,
dict
):
if
not
isinstance
(
d
,
dict
):
...
@@ -578,7 +581,7 @@ def create_app(args):
...
@@ -578,7 +581,7 @@ def create_app(args):
try
:
try
:
filename
=
str
(
uuid
.
uuid4
())
+
'
.
'
+
secure_filename
(
file
.
filename
)
filename
=
str
(
uuid
.
uuid4
())
+
'
.
'
+
secure_filename
(
file
.
filename
)
filepath
=
os
.
path
.
join
(
tempfile
.
gettemp
dir
(),
filename
)
filepath
=
os
.
path
.
join
(
get_upload_
dir
(),
filename
)
file
.
save
(
filepath
)
file
.
save
(
filepath
)
...
@@ -600,7 +603,7 @@ def create_app(args):
...
@@ -600,7 +603,7 @@ def create_app(args):
Download a translated file
Download a translated file
"""
"""
filename
.
split
(
'
.
'
).
pop
(
0
)
filename
.
split
(
'
.
'
).
pop
(
0
)
filepath
=
os
.
path
.
join
(
tempfile
.
gettemp
dir
(),
filename
)
filepath
=
os
.
path
.
join
(
get_upload_
dir
(),
filename
)
return_data
=
io
.
BytesIO
()
return_data
=
io
.
BytesIO
()
with
open
(
filepath
,
'
rb
'
)
as
fo
:
with
open
(
filepath
,
'
rb
'
)
as
fo
:
...
...
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