History

Making JS/QML safer (DOES NOT WORK)

elisa-lj11 committed 10 years ago

Commit 9ea9bae1 parent b8f5a9d5 files · +13 −8Browse files

Showing the changes to libraries/script-engine/src/FileScriptingInterface.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/FileScriptingInterface.cpp+6−2
@@ -31,9 +31,13 @@ FileScriptingInterface::FileScriptingInterface(QObject* parent) : QObject(parent · 30 unmodified lines
31 // nothing for now31 // nothing for now
32}32}
33 33
34void FileScriptingInterface::runUnzip(QString path, QString tempDir, QUrl url) {34void FileScriptingInterface::runUnzip(QString path, QUrl url) {
35 qDebug() << "Url that was downloaded: " + url.toString();35 qDebug() << "Url that was downloaded: " + url.toString();
36 qDebug() << "Path where download is saved: " + path;36 qDebug() << "Path where download is saved: " + path;
37 QString fileName = "/" + path.section("/", -1);
38 qDebug() << "Filename to remove from temp path: " + fileName;
39 QString tempDir = path.remove(fileName);
40 qDebug() << "Temporary directory at: " + tempDir;
37 QString file = unzipFile(path, tempDir);41 QString file = unzipFile(path, tempDir);
38 if (file != "") {42 if (file != "") {
39 qDebug() << "file to upload: " + file;43 qDebug() << "file to upload: " + file;
@@ -47,7 +51,7 @@ void FileScriptingInterface::runUnzip(QString path, QString tempDir, QUrl url) { · 7 unmodified lines
47 QDir(tempDir).removeRecursively();51 QDir(tempDir).removeRecursively();
48}52}
49 53
50bool FileScriptingInterface::testUrl(QUrl url) {54bool FileScriptingInterface::isZippedFbx(QUrl url) {
51 if (url.toString().contains(".zip") && url.toString().contains("fbx")) return true;55 if (url.toString().contains(".zip") && url.toString().contains("fbx")) return true;
52 qDebug() << "This model is not a .fbx packaged in a .zip. Please try with another model.";56 qDebug() << "This model is not a .fbx packaged in a .zip. Please try with another model.";
53 return false;57 return false;