Merge branch '345_file_readability_fix' of https://github.com/mig5/onionshare into mig5-345_file_readability_fix

This commit is contained in:
Micah Lee 2017-05-18 10:43:29 -07:00
commit 959f637b49
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
4 changed files with 13 additions and 1 deletions

View File

@ -67,6 +67,9 @@ def main(cwd=None):
if not os.path.exists(filename):
print(strings._("not_a_file").format(filename))
valid = False
if not os.access(filename, os.R_OK):
print(strings._("not_a_readable_file").format(filename))
valid = False
if not valid:
sys.exit()

View File

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from __future__ import division
import os, sys, platform, argparse
from .alert import Alert
from PyQt5 import QtCore, QtWidgets
from onionshare import strings, common, web
@ -88,6 +89,9 @@ def main():
if not os.path.exists(filename):
Alert(strings._("not_a_file", True).format(filename))
valid = False
if not os.access(filename, os.R_OK):
Alert(strings._("not_a_readable_file", True).format(filename))
valid = False
if not valid:
sys.exit()

View File

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
from PyQt5 import QtCore, QtWidgets, QtGui
from .alert import Alert
from onionshare import strings, common
@ -213,7 +214,10 @@ class FileSelection(QtWidgets.QVBoxLayout):
caption=strings._('gui_choose_files', True), options=QtWidgets.QFileDialog.ReadOnly)
if filenames:
for filename in filenames[0]:
self.file_list.add_file(filename)
if not os.access(filename, os.R_OK):
Alert(strings._("not_a_readable_file", True).format(filename))
else:
self.file_list.add_file(filename)
self.update()
def add_dir(self):

View File

@ -9,6 +9,7 @@
"give_this_url_stealth": "Give this URL and HidServAuth line to the person you're sending the file to:",
"ctrlc_to_stop": "Press Ctrl-C to stop server",
"not_a_file": "{0:s} is not a file.",
"not_a_readable_file": "{0:s} is not a readable file.",
"download_page_loaded": "Download page loaded",
"other_page_loaded": "URL loaded",
"closing_automatically": "Closing automatically because download finished",