Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
361a1243
Commit
361a1243
authored
Feb 27, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements #828
parent
fad62a09
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
66 deletions
+63
-66
uploadprogress.js
cps/static/js/uploadprogress.js
+2
-2
layout.html
cps/templates/layout.html
+2
-1
messages.mo
cps/translations/de/LC_MESSAGES/messages.mo
+0
-0
messages.po
cps/translations/de/LC_MESSAGES/messages.po
+52
-52
web.py
cps/web.py
+7
-11
No files found.
cps/static/js/uploadprogress.js
View file @
361a1243
...
@@ -132,8 +132,8 @@
...
@@ -132,8 +132,8 @@
// Replace the contents of the form, with the returned html
// Replace the contents of the form, with the returned html
if
(
xhr
.
status
===
422
)
{
if
(
xhr
.
status
===
422
)
{
var
newHtml
=
$
.
parseHTML
(
xhr
.
responseText
);
var
newHtml
=
$
.
parseHTML
(
xhr
.
responseText
);
this
.
replace_form
(
newHtml
);
this
.
$modalBar
.
text
(
newHtml
[
0
].
data
);
this
.
$modal
.
modal
(
"hide"
);
//
this.$modal.modal("hide");
}
}
// Write the error response to the document.
// Write the error response to the document.
else
{
else
{
...
...
cps/templates/layout.html
View file @
361a1243
...
@@ -62,7 +62,8 @@
...
@@ -62,7 +62,8 @@
<li>
<li>
<form
id=
"form-upload"
class=
"navbar-form"
action=
"{{ url_for('upload') }}"
method=
"post"
enctype=
"multipart/form-data"
>
<form
id=
"form-upload"
class=
"navbar-form"
action=
"{{ url_for('upload') }}"
method=
"post"
enctype=
"multipart/form-data"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<span
class=
"btn btn-default btn-file"
>
{{_('Upload')}}
<input
id=
"btn-upload"
name=
"btn-upload"
type=
"file"
multiple
></span>
<span
class=
"btn btn-default btn-file"
>
{{_('Upload')}}
<input
id=
"btn-upload"
name=
"btn-upload"
type=
"file"
accept=
"{% for format in accept %}.{{format}}{{ ',' if not loop.last }}{% endfor %}"
multiple
></span>
</div>
</div>
</form>
</form>
</li>
</li>
...
...
cps/translations/de/LC_MESSAGES/messages.mo
View file @
361a1243
No preview for this file type
cps/translations/de/LC_MESSAGES/messages.po
View file @
361a1243
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: Calibre-Web\n"
"Project-Id-Version: Calibre-Web\n"
"Report-Msgid-Bugs-To: https://github.com/janeczku/Calibre-Web\n"
"Report-Msgid-Bugs-To: https://github.com/janeczku/Calibre-Web\n"
"POT-Creation-Date: 2019-02-2
4 19:21
+0100\n"
"POT-Creation-Date: 2019-02-2
7 19:28
+0100\n"
"PO-Revision-Date: 2019-02-24 19:15+0100\n"
"PO-Revision-Date: 2019-02-24 19:15+0100\n"
"Last-Translator: Ozzie Isaacs\n"
"Last-Translator: Ozzie Isaacs\n"
"Language: de\n"
"Language: de\n"
...
@@ -310,7 +310,7 @@ msgstr "Kategorieliste"
...
@@ -310,7 +310,7 @@ msgstr "Kategorieliste"
msgid "Category: %(name)s"
msgid "Category: %(name)s"
msgstr "Kategorie: %(name)s"
msgstr "Kategorie: %(name)s"
#: cps/templates/layout.html:7
2
cps/web.py:1628
#: cps/templates/layout.html:7
3
cps/web.py:1628
msgid "Tasks"
msgid "Tasks"
msgstr "Aufgaben"
msgstr "Aufgaben"
...
@@ -357,12 +357,12 @@ msgid "search"
...
@@ -357,12 +357,12 @@ msgid "search"
msgstr "Suche"
msgstr "Suche"
#: cps/templates/index.xml:47 cps/templates/index.xml:51
#: cps/templates/index.xml:47 cps/templates/index.xml:51
#: cps/templates/layout.html:14
7
cps/web.py:2095
#: cps/templates/layout.html:14
8
cps/web.py:2095
msgid "Read Books"
msgid "Read Books"
msgstr "Gelesene Bücher"
msgstr "Gelesene Bücher"
#: cps/templates/index.xml:55 cps/templates/index.xml:59
#: cps/templates/index.xml:55 cps/templates/index.xml:59
#: cps/templates/layout.html:1
49
cps/web.py:2098
#: cps/templates/layout.html:1
50
cps/web.py:2098
msgid "Unread Books"
msgid "Unread Books"
msgstr "Ungelesene Bücher"
msgstr "Ungelesene Bücher"
...
@@ -667,16 +667,16 @@ msgstr "Buch öffnen fehlgeschlagen. Datei existiert nicht, oder ist nicht zugä
...
@@ -667,16 +667,16 @@ msgstr "Buch öffnen fehlgeschlagen. Datei existiert nicht, oder ist nicht zugä
msgid "edit metadata"
msgid "edit metadata"
msgstr "Metadaten editieren"
msgstr "Metadaten editieren"
#: cps/web.py:3490 cps/web.py:373
7
#: cps/web.py:3490 cps/web.py:373
6
#, python-format
#, python-format
msgid "File extension '%(ext)s' is not allowed to be uploaded to this server"
msgid "File extension '%(ext)s' is not allowed to be uploaded to this server"
msgstr "Dateiendung '%(ext)s' kann nicht auf diesen Server hochgeladen werden"
msgstr "Dateiendung '%(ext)s' kann nicht auf diesen Server hochgeladen werden"
#: cps/web.py:3494 cps/web.py:37
41
#: cps/web.py:3494 cps/web.py:37
39
msgid "File to be uploaded must have an extension"
msgid "File to be uploaded must have an extension"
msgstr "Dateien müssen eine Erweiterung haben, um hochgeladen zu werden"
msgstr "Dateien müssen eine Erweiterung haben, um hochgeladen zu werden"
#: cps/web.py:3506 cps/web.py:37
61
#: cps/web.py:3506 cps/web.py:37
58
#, python-format
#, python-format
msgid "Failed to create path %(path)s (Permission denied)."
msgid "Failed to create path %(path)s (Permission denied)."
msgstr "Fehler beim Erzeugen des Pfads %(path)s (Zugriff verweigert)"
msgstr "Fehler beim Erzeugen des Pfads %(path)s (Zugriff verweigert)"
...
@@ -726,31 +726,31 @@ msgstr "Metadaten wurden erfolgreich aktualisiert"
...
@@ -726,31 +726,31 @@ msgstr "Metadaten wurden erfolgreich aktualisiert"
msgid "Error editing book, please check logfile for details"
msgid "Error editing book, please check logfile for details"
msgstr "Fehler beim Editieren des Buchs, Details im Logfile"
msgstr "Fehler beim Editieren des Buchs, Details im Logfile"
#: cps/web.py:376
6
#: cps/web.py:376
2
#, python-format
#, python-format
msgid "Failed to store file %(file)s (Permission denied)."
msgid "Failed to store file %(file)s (Permission denied)."
msgstr "Fehler beim speichern der Datei %(file)s (Zugriff verweigert)"
msgstr "Fehler beim speichern der Datei %(file)s (Zugriff verweigert)"
#: cps/web.py:37
71
#: cps/web.py:37
67
#, python-format
#, python-format
msgid "Failed to delete file %(file)s (Permission denied)."
msgid "Failed to delete file %(file)s (Permission denied)."
msgstr "Fehler beim Löschen von Datei %(file)s (Zugriff verweigert)"
msgstr "Fehler beim Löschen von Datei %(file)s (Zugriff verweigert)"
#: cps/web.py:385
4
#: cps/web.py:385
0
#, python-format
#, python-format
msgid "File %(title)s"
msgid "File %(title)s"
msgstr "Datei %(title)s"
msgstr "Datei %(title)s"
#: cps/web.py:38
83
#: cps/web.py:38
79
msgid "Source or destination format for conversion missing"
msgid "Source or destination format for conversion missing"
msgstr "Quell- oder Zielformat für Konvertierung fehlt"
msgstr "Quell- oder Zielformat für Konvertierung fehlt"
#: cps/web.py:38
93
#: cps/web.py:38
89
#, python-format
#, python-format
msgid "Book successfully queued for converting to %(book_format)s"
msgid "Book successfully queued for converting to %(book_format)s"
msgstr "Buch wurde erfolgreich für die Konvertierung in das %(book_format)s Format eingereiht"
msgstr "Buch wurde erfolgreich für die Konvertierung in das %(book_format)s Format eingereiht"
#: cps/web.py:389
7
#: cps/web.py:389
3
#, python-format
#, python-format
msgid "There was an error converting this book: %(res)s"
msgid "There was an error converting this book: %(res)s"
msgstr "Es trat ein Fehlker beim Konvertieren des Buches auf: %(res)s"
msgstr "Es trat ein Fehlker beim Konvertieren des Buches auf: %(res)s"
...
@@ -785,7 +785,7 @@ msgstr "Kindle"
...
@@ -785,7 +785,7 @@ msgstr "Kindle"
msgid "DLS"
msgid "DLS"
msgstr "DLS"
msgstr "DLS"
#: cps/templates/admin.html:13 cps/templates/layout.html:7
5
#: cps/templates/admin.html:13 cps/templates/layout.html:7
6
msgid "Admin"
msgid "Admin"
msgstr "Admin"
msgstr "Admin"
...
@@ -996,7 +996,7 @@ msgstr "Beschreibung"
...
@@ -996,7 +996,7 @@ msgstr "Beschreibung"
msgid "Tags"
msgid "Tags"
msgstr "Tags"
msgstr "Tags"
#: cps/templates/book_edit.html:75 cps/templates/layout.html:15
8
#: cps/templates/book_edit.html:75 cps/templates/layout.html:15
9
#: cps/templates/search_form.html:53
#: cps/templates/search_form.html:53
msgid "Series"
msgid "Series"
msgstr "Serien"
msgstr "Serien"
...
@@ -1090,8 +1090,8 @@ msgstr "Klicke auf das Bild um die Metadaten zu übertragen"
...
@@ -1090,8 +1090,8 @@ msgstr "Klicke auf das Bild um die Metadaten zu übertragen"
msgid "Loading..."
msgid "Loading..."
msgstr "Lade..."
msgstr "Lade..."
#: cps/templates/book_edit.html:239 cps/templates/layout.html:22
5
#: cps/templates/book_edit.html:239 cps/templates/layout.html:22
6
#: cps/templates/layout.html:25
7
#: cps/templates/layout.html:25
8
msgid "Close"
msgid "Close"
msgstr "Schließen"
msgstr "Schließen"
...
@@ -1259,7 +1259,7 @@ msgstr "Pfad zu Konvertertool"
...
@@ -1259,7 +1259,7 @@ msgstr "Pfad zu Konvertertool"
msgid "Location of Unrar binary"
msgid "Location of Unrar binary"
msgstr "Pfad zum UnRar Programm"
msgstr "Pfad zum UnRar Programm"
#: cps/templates/config_edit.html:229 cps/templates/layout.html:8
3
#: cps/templates/config_edit.html:229 cps/templates/layout.html:8
4
#: cps/templates/login.html:4
#: cps/templates/login.html:4
msgid "Login"
msgid "Login"
msgstr "Login"
msgstr "Login"
...
@@ -1268,8 +1268,8 @@ msgstr "Login"
...
@@ -1268,8 +1268,8 @@ msgstr "Login"
msgid "View Configuration"
msgid "View Configuration"
msgstr "Ansichtskonfiguration"
msgstr "Ansichtskonfiguration"
#: cps/templates/config_view_edit.html:19 cps/templates/layout.html:13
4
#: cps/templates/config_view_edit.html:19 cps/templates/layout.html:13
5
#: cps/templates/layout.html:13
5
cps/templates/shelf_edit.html:7
#: cps/templates/layout.html:13
6
cps/templates/shelf_edit.html:7
msgid "Title"
msgid "Title"
msgstr "Titel"
msgstr "Titel"
...
@@ -1489,7 +1489,7 @@ msgstr "Hinzufügen"
...
@@ -1489,7 +1489,7 @@ msgstr "Hinzufügen"
msgid "Do you really want to delete this domain rule?"
msgid "Do you really want to delete this domain rule?"
msgstr "Soll diese Domain Regel wirklich gelöscht werden?"
msgstr "Soll diese Domain Regel wirklich gelöscht werden?"
#: cps/templates/feed.xml:21 cps/templates/layout.html:2
09
#: cps/templates/feed.xml:21 cps/templates/layout.html:2
10
msgid "Next"
msgid "Next"
msgstr "Nächste"
msgstr "Nächste"
...
@@ -1510,7 +1510,7 @@ msgstr "Entdecke (Zufälliges Buch)"
...
@@ -1510,7 +1510,7 @@ msgstr "Entdecke (Zufälliges Buch)"
msgid "Start"
msgid "Start"
msgstr "Start"
msgstr "Start"
#: cps/templates/index.xml:18 cps/templates/layout.html:14
0
#: cps/templates/index.xml:18 cps/templates/layout.html:14
1
msgid "Hot Books"
msgid "Hot Books"
msgstr "Beliebte Bücher"
msgstr "Beliebte Bücher"
...
@@ -1518,7 +1518,7 @@ msgstr "Beliebte Bücher"
...
@@ -1518,7 +1518,7 @@ msgstr "Beliebte Bücher"
msgid "Popular publications from this catalog based on Downloads."
msgid "Popular publications from this catalog based on Downloads."
msgstr "Beliebte Publikationen aus dieser Bibliothek basierend auf Downloadzahlen."
msgstr "Beliebte Publikationen aus dieser Bibliothek basierend auf Downloadzahlen."
#: cps/templates/index.xml:25 cps/templates/layout.html:14
3
#: cps/templates/index.xml:25 cps/templates/layout.html:14
4
msgid "Best rated Books"
msgid "Best rated Books"
msgstr "Best bewertete Bücher"
msgstr "Best bewertete Bücher"
...
@@ -1538,7 +1538,7 @@ msgstr "Die neuesten Bücher"
...
@@ -1538,7 +1538,7 @@ msgstr "Die neuesten Bücher"
msgid "Show Random Books"
msgid "Show Random Books"
msgstr "Zeige zufällige Bücher"
msgstr "Zeige zufällige Bücher"
#: cps/templates/index.xml:62 cps/templates/layout.html:16
1
#: cps/templates/index.xml:62 cps/templates/layout.html:16
2
msgid "Authors"
msgid "Authors"
msgstr "Autoren"
msgstr "Autoren"
...
@@ -1546,7 +1546,7 @@ msgstr "Autoren"
...
@@ -1546,7 +1546,7 @@ msgstr "Autoren"
msgid "Books ordered by Author"
msgid "Books ordered by Author"
msgstr "Bücher nach Autoren sortiert"
msgstr "Bücher nach Autoren sortiert"
#: cps/templates/index.xml:69 cps/templates/layout.html:16
4
#: cps/templates/index.xml:69 cps/templates/layout.html:16
5
msgid "Publishers"
msgid "Publishers"
msgstr "Verleger"
msgstr "Verleger"
...
@@ -1562,7 +1562,7 @@ msgstr "Bücher nach Kategorien sortiert"
...
@@ -1562,7 +1562,7 @@ msgstr "Bücher nach Kategorien sortiert"
msgid "Books ordered by series"
msgid "Books ordered by series"
msgstr "Bücher nach Reihen geordnet"
msgstr "Bücher nach Reihen geordnet"
#: cps/templates/index.xml:90 cps/templates/layout.html:17
0
#: cps/templates/index.xml:90 cps/templates/layout.html:17
1
msgid "Public Shelves"
msgid "Public Shelves"
msgstr "Öffentliche Bücherregale"
msgstr "Öffentliche Bücherregale"
...
@@ -1570,7 +1570,7 @@ msgstr "Öffentliche Bücherregale"
...
@@ -1570,7 +1570,7 @@ msgstr "Öffentliche Bücherregale"
msgid "Books organized in public shelfs, visible to everyone"
msgid "Books organized in public shelfs, visible to everyone"
msgstr "Bücher organisiert in öffentlichem Bücherregal, sichtbar für jedermann"
msgstr "Bücher organisiert in öffentlichem Bücherregal, sichtbar für jedermann"
#: cps/templates/index.xml:98 cps/templates/layout.html:17
4
#: cps/templates/index.xml:98 cps/templates/layout.html:17
5
msgid "Your Shelves"
msgid "Your Shelves"
msgstr "Deine Bücherregale"
msgstr "Deine Bücherregale"
...
@@ -1590,99 +1590,99 @@ msgstr "Nagivation umschalten"
...
@@ -1590,99 +1590,99 @@ msgstr "Nagivation umschalten"
msgid "Advanced Search"
msgid "Advanced Search"
msgstr "Erweiterte Suche"
msgstr "Erweiterte Suche"
#: cps/templates/layout.html:7
5
cps/templates/read.html:71
#: cps/templates/layout.html:7
6
cps/templates/read.html:71
#: cps/templates/readcbr.html:79 cps/templates/readcbr.html:103
#: cps/templates/readcbr.html:79 cps/templates/readcbr.html:103
msgid "Settings"
msgid "Settings"
msgstr "Einstellungen"
msgstr "Einstellungen"
#: cps/templates/layout.html:7
7
#: cps/templates/layout.html:7
8
msgid "Account"
msgid "Account"
msgstr "Benutzerkonto"
msgstr "Benutzerkonto"
#: cps/templates/layout.html:
79
#: cps/templates/layout.html:
80
msgid "Logout"
msgid "Logout"
msgstr "Logout"
msgstr "Logout"
#: cps/templates/layout.html:8
4
cps/templates/register.html:14
#: cps/templates/layout.html:8
5
cps/templates/register.html:14
msgid "Register"
msgid "Register"
msgstr "Registrieren"
msgstr "Registrieren"
#: cps/templates/layout.html:11
0 cps/templates/layout.html:256
#: cps/templates/layout.html:11
1 cps/templates/layout.html:257
msgid "Uploading..."
msgid "Uploading..."
msgstr "Hochladen..."
msgstr "Hochladen..."
#: cps/templates/layout.html:11
1
#: cps/templates/layout.html:11
2
msgid "please don't refresh the page"
msgid "please don't refresh the page"
msgstr "Bitte die Seite nicht neu laden"
msgstr "Bitte die Seite nicht neu laden"
#: cps/templates/layout.html:12
1
#: cps/templates/layout.html:12
2
msgid "Browse"
msgid "Browse"
msgstr "Browsen"
msgstr "Browsen"
#: cps/templates/layout.html:12
3
#: cps/templates/layout.html:12
4
msgid "Recently Added"
msgid "Recently Added"
msgstr "Kürzlich hinzugefügt"
msgstr "Kürzlich hinzugefügt"
#: cps/templates/layout.html:12
8
#: cps/templates/layout.html:12
9
msgid "Sorted Books"
msgid "Sorted Books"
msgstr "Bücher Sortiert"
msgstr "Bücher Sortiert"
#: cps/templates/layout.html:13
2 cps/templates/layout.html:133
#: cps/templates/layout.html:13
3 cps/templates/layout.html:134
#: cps/templates/layout.html:13
4 cps/templates/layout.html:135
#: cps/templates/layout.html:13
5 cps/templates/layout.html:136
msgid "Sort By"
msgid "Sort By"
msgstr "Sortiert nach"
msgstr "Sortiert nach"
#: cps/templates/layout.html:13
2
#: cps/templates/layout.html:13
3
msgid "Newest"
msgid "Newest"
msgstr "Neueste"
msgstr "Neueste"
#: cps/templates/layout.html:13
3
#: cps/templates/layout.html:13
4
msgid "Oldest"
msgid "Oldest"
msgstr "Älteste"
msgstr "Älteste"
#: cps/templates/layout.html:13
4
#: cps/templates/layout.html:13
5
msgid "Ascending"
msgid "Ascending"
msgstr "Aufsteigend"
msgstr "Aufsteigend"
#: cps/templates/layout.html:13
5
#: cps/templates/layout.html:13
6
msgid "Descending"
msgid "Descending"
msgstr "Absteigend"
msgstr "Absteigend"
#: cps/templates/layout.html:15
2
#: cps/templates/layout.html:15
3
msgid "Discover"
msgid "Discover"
msgstr "Entdecke"
msgstr "Entdecke"
#: cps/templates/layout.html:15
5
#: cps/templates/layout.html:15
6
msgid "Categories"
msgid "Categories"
msgstr "Kategorien"
msgstr "Kategorien"
#: cps/templates/layout.html:16
7
cps/templates/search_form.html:74
#: cps/templates/layout.html:16
8
cps/templates/search_form.html:74
msgid "Languages"
msgid "Languages"
msgstr "Sprachen"
msgstr "Sprachen"
#: cps/templates/layout.html:1
79
#: cps/templates/layout.html:1
80
msgid "Create a Shelf"
msgid "Create a Shelf"
msgstr "Bücherregal erzeugen"
msgstr "Bücherregal erzeugen"
#: cps/templates/layout.html:18
0
cps/templates/stats.html:3
#: cps/templates/layout.html:18
1
cps/templates/stats.html:3
msgid "About"
msgid "About"
msgstr "Über"
msgstr "Über"
#: cps/templates/layout.html:19
4
#: cps/templates/layout.html:19
5
msgid "Previous"
msgid "Previous"
msgstr "Vorheriger"
msgstr "Vorheriger"
#: cps/templates/layout.html:22
1
#: cps/templates/layout.html:22
2
msgid "Book Details"
msgid "Book Details"
msgstr "Buchdetails"
msgstr "Buchdetails"
#: cps/templates/layout.html:25
5
#: cps/templates/layout.html:25
6
msgid "Upload done, processing, please wait..."
msgid "Upload done, processing, please wait..."
msgstr "Hochladen beendet, verarbeite Daten, bitte warten..."
msgstr "Hochladen beendet, verarbeite Daten, bitte warten..."
#: cps/templates/layout.html:25
8
#: cps/templates/layout.html:25
9
msgid "Error"
msgid "Error"
msgstr "Feh
k
er"
msgstr "Feh
l
er"
#: cps/templates/login.html:8 cps/templates/login.html:9
#: cps/templates/login.html:8 cps/templates/login.html:9
#: cps/templates/register.html:7 cps/templates/user_edit.html:8
#: cps/templates/register.html:7 cps/templates/user_edit.html:8
...
...
cps/web.py
View file @
361a1243
...
@@ -698,7 +698,7 @@ def render_xml_template(*args, **kwargs):
...
@@ -698,7 +698,7 @@ def render_xml_template(*args, **kwargs):
# Returns the template for redering and includes the instance name
# Returns the template for redering and includes the instance name
def
render_title_template
(
*
args
,
**
kwargs
):
def
render_title_template
(
*
args
,
**
kwargs
):
return
render_template
(
instance
=
config
.
config_calibre_web_title
,
*
args
,
**
kwargs
)
return
render_template
(
instance
=
config
.
config_calibre_web_title
,
accept
=
EXTENSIONS_UPLOAD
,
*
args
,
**
kwargs
)
@
app
.
before_request
@
app
.
before_request
...
@@ -3733,13 +3733,10 @@ def upload():
...
@@ -3733,13 +3733,10 @@ def upload():
if
'.'
in
requested_file
.
filename
:
if
'.'
in
requested_file
.
filename
:
file_ext
=
requested_file
.
filename
.
rsplit
(
'.'
,
1
)[
-
1
]
.
lower
()
file_ext
=
requested_file
.
filename
.
rsplit
(
'.'
,
1
)[
-
1
]
.
lower
()
if
file_ext
not
in
EXTENSIONS_UPLOAD
:
if
file_ext
not
in
EXTENSIONS_UPLOAD
:
flash
(
return
Response
(
_
(
"File extension '
%(ext)
s' is not allowed to be uploaded to this server"
,
_
(
"File extension '
%(ext)
s' is not allowed to be uploaded to this server"
,
ext
=
file_ext
)),
422
ext
=
file_ext
),
category
=
"error"
)
return
redirect
(
url_for
(
'index'
))
else
:
else
:
flash
(
_
(
'File to be uploaded must have an extension'
),
category
=
"error"
)
return
Response
(
_
(
'File to be uploaded must have an extension'
)),
422
return
redirect
(
url_for
(
'index'
))
# extract metadata from file
# extract metadata from file
meta
=
uploader
.
upload
(
requested_file
)
meta
=
uploader
.
upload
(
requested_file
)
...
@@ -3758,13 +3755,12 @@ def upload():
...
@@ -3758,13 +3755,12 @@ def upload():
try
:
try
:
os
.
makedirs
(
filepath
)
os
.
makedirs
(
filepath
)
except
OSError
:
except
OSError
:
flash
(
_
(
u"Failed to create path
%(path)
s (Permission denied)."
,
path
=
filepath
),
category
=
"error"
)
return
Response
(
_
(
u"Failed to create path
%(path)
s (Permission denied)."
,
path
=
filepath
)),
422
return
redirect
(
url_for
(
'index'
))
try
:
try
:
copyfile
(
meta
.
file_path
,
saved_filename
)
copyfile
(
meta
.
file_path
,
saved_filename
)
except
OSError
:
except
OSError
:
flash
(
_
(
u"Failed to store file
%(file)
s (Permission denied)."
,
file
=
saved_filename
),
category
=
"error"
)
return
Response
(
_
(
u"Failed to store file
%(file)
s (Permission denied)."
,
file
=
saved_filename
)),
422
return
redirect
(
url_for
(
'index'
))
try
:
try
:
os
.
unlink
(
meta
.
file_path
)
os
.
unlink
(
meta
.
file_path
)
except
OSError
:
except
OSError
:
...
...
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