Move downloads_dir validation into the /upload request in Web, and display an error in both CLI and GUI

This commit is contained in:
Micah Lee 2018-05-19 21:11:57 -07:00
parent c23ab77a58
commit db7d5a6552
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
3 changed files with 25 additions and 17 deletions

View file

@ -393,6 +393,12 @@ class OnionShareGui(QtWidgets.QMainWindow):
elif event["type"] == Web.REQUEST_UPLOAD_FILE_RENAMED:
mode.handle_request_upload_file_renamed(event)
if event["type"] == Web.REQUEST_ERROR_DOWNLOADS_DIR_CANNOT_CREATE:
Alert(self.common, strings._('error_cannot_create_downloads_dir').format(self.common.settings.get('downloads_dir')))
if event["type"] == Web.REQUEST_ERROR_DOWNLOADS_DIR_NOT_WRITABLE:
Alert(self.common, strings._('error_downloads_dir_not_writable').format(self.common.settings.get('downloads_dir')))
elif event["path"] != '/favicon.ico':
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(mode.web.error404_count, strings._('other_page_loaded', True), event["path"]))