mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-14 13:41:25 -05:00
Merge branch '345_file_readability_fix' of https://github.com/mig5/onionshare into mig5-345_file_readability_fix
This commit is contained in:
commit
fd02f843d9
@ -67,6 +67,9 @@ def main(cwd=None):
|
|||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
print(strings._("not_a_file").format(filename))
|
print(strings._("not_a_file").format(filename))
|
||||||
valid = False
|
valid = False
|
||||||
|
if not os.access(filename, os.R_OK):
|
||||||
|
print(strings._("not_a_readable_file").format(filename))
|
||||||
|
valid = False
|
||||||
if not valid:
|
if not valid:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import os, sys, platform, argparse
|
import os, sys, platform, argparse
|
||||||
|
from .alert import Alert
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
from onionshare import strings, common, web
|
from onionshare import strings, common, web
|
||||||
@ -88,6 +89,9 @@ def main():
|
|||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
Alert(strings._("not_a_file", True).format(filename))
|
Alert(strings._("not_a_file", True).format(filename))
|
||||||
valid = False
|
valid = False
|
||||||
|
if not os.access(filename, os.R_OK):
|
||||||
|
Alert(strings._("not_a_readable_file", True).format(filename))
|
||||||
|
valid = False
|
||||||
if not valid:
|
if not valid:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||||
|
from .alert import Alert
|
||||||
|
|
||||||
from onionshare import strings, common
|
from onionshare import strings, common
|
||||||
|
|
||||||
@ -213,7 +214,10 @@ class FileSelection(QtWidgets.QVBoxLayout):
|
|||||||
caption=strings._('gui_choose_files', True), options=QtWidgets.QFileDialog.ReadOnly)
|
caption=strings._('gui_choose_files', True), options=QtWidgets.QFileDialog.ReadOnly)
|
||||||
if filenames:
|
if filenames:
|
||||||
for filename in filenames[0]:
|
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()
|
self.update()
|
||||||
|
|
||||||
def add_dir(self):
|
def add_dir(self):
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"give_this_url_stealth": "Give this URL and HidServAuth line to the person you're sending the file to:",
|
"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",
|
"ctrlc_to_stop": "Press Ctrl-C to stop server",
|
||||||
"not_a_file": "{0:s} is not a file.",
|
"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",
|
"download_page_loaded": "Download page loaded",
|
||||||
"other_page_loaded": "URL loaded",
|
"other_page_loaded": "URL loaded",
|
||||||
"closing_automatically": "Closing automatically because download finished",
|
"closing_automatically": "Closing automatically because download finished",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user