Skip to content

Commit 85d30f4

Browse files
committed
return info as "reason"
1 parent dd622c6 commit 85d30f4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

qiita_pet/handlers/cloud_handlers/file_transfer_handlers.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ def get(self, requested_filepath):
3030
# attempt to access files outside of the BASE_DATA_DIR
3131
# intentionally NOT reporting the actual location to avoid exposing
3232
# instance internal information
33-
raise HTTPError(403, ("You cannot access files outside of "
34-
"the BASE_DATA_DIR of Qiita!"))
33+
raise HTTPError(403, reason=(
34+
"You cannot access files outside of "
35+
"the BASE_DATA_DIR of Qiita!"))
3536

3637
if not os.path.exists(filepath):
37-
raise HTTPError(403, ("The requested file is not present in "
38-
"Qiita's BASE_DATA_DIR!"))
38+
raise HTTPError(403, reason=(
39+
"The requested file is not present in Qiita's BASE_DATA_DIR!"))
3940

4041
# delivery of the file via nginx requires replacing the basedatadir
4142
# with the prefix defined in the nginx configuration for the
@@ -59,7 +60,7 @@ class PushFileToCentralHandler(RequestHandler):
5960
@execute_as_transaction
6061
def post(self):
6162
if not self.request.files:
62-
raise HTTPError(400, 'No files to upload defined!')
63+
raise HTTPError(400, reason='No files to upload defined!')
6364

6465
# canonic version of base_data_dir
6566
basedatadir = os.path.abspath(qiita_config.base_data_dir)
@@ -77,8 +78,9 @@ def post(self):
7778
filepath = os.path.abspath(os.path.join(basedatadir, filepath))
7879

7980
if os.path.exists(filepath):
80-
raise HTTPError(403, ("The requested file is already "
81-
"present in Qiita's BASE_DATA_DIR!"))
81+
raise HTTPError(403, reason=(
82+
"The requested file is already "
83+
"present in Qiita's BASE_DATA_DIR!"))
8284

8385
os.makedirs(os.path.dirname(filepath), exist_ok=True)
8486
with open(filepath, "wb") as f:

0 commit comments

Comments
 (0)