From 9e5513ade6d44758546c5f31beaf484249d967db Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 21 Mar 2017 09:58:16 +0100 Subject: [PATCH] Use QUrl to parse fileUrl CURA-3495 --- cura/CuraApplication.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index c5f17c071a..47f826f0de 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1269,15 +1269,10 @@ class CuraApplication(QtApplication): """ Checks if the given file URL is a valid project file. """ - file_url_prefix = 'file:///' - - file_name = file_url - if file_name.startswith(file_url_prefix): - file_name = file_name[len(file_url_prefix):] - - workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_name) + file_path = QUrl(file_url).toLocalFile() + workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path) if workspace_reader is None: return False # non-project files won't get a reader - result = workspace_reader.preRead(file_name, show_dialog=False) + result = workspace_reader.preRead(file_path, show_dialog=False) return result == WorkspaceReader.PreReadResult.accepted