1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-09-16 08:56:40 +02:00

Don't deal with files outside of root during OneDrive sync

This commit is contained in:
Laurent Cozic
2017-08-18 22:46:39 +02:00
parent e81178ec3d
commit 0cf8d3fd74
9 changed files with 43 additions and 22 deletions

View File

@@ -307,7 +307,7 @@ class Application {
let CommandClass = null;
try {
CommandClass = require('./command-' + name + '.js');
CommandClass = require(__dirname + '/command-' + name + '.js');
} catch (error) {
let e = new Error('No such command: ' + name);
e.type = 'notFound';

View File

@@ -260,9 +260,6 @@ msgstr ""
msgid "Starting synchronisation..."
msgstr ""
msgid "Done."
msgstr ""
msgid "Cancelling... Please wait."
msgstr ""

View File

@@ -289,9 +289,6 @@ msgstr "Impossible d'initialiser la synchronisation."
msgid "Starting synchronisation..."
msgstr "Commencement de la synchronisation..."
msgid "Done."
msgstr "Terminé."
#, fuzzy
msgid "Cancelling... Please wait."
msgstr "Annulation..."
@@ -621,6 +618,9 @@ msgstr ""
msgid "Welcome"
msgstr "Bienvenue"
#~ msgid "Done."
#~ msgstr "Terminé."
#~ msgid ""
#~ "Please open this URL in your browser to authenticate the application:"
#~ msgstr ""

View File

@@ -260,9 +260,6 @@ msgstr ""
msgid "Starting synchronisation..."
msgstr ""
msgid "Done."
msgstr ""
msgid "Cancelling... Please wait."
msgstr ""

View File

@@ -7,7 +7,7 @@
"url": "https://github.com/laurent22/joplin"
},
"url": "git://github.com/laurent22/joplin.git",
"version": "0.9.2",
"version": "0.9.5",
"bin": {
"joplin": "./main.js"
},
@@ -38,7 +38,8 @@
"string-to-stream": "^1.1.0",
"tcp-port-used": "^0.1.2",
"uuid": "^3.0.1",
"yargs-parser": "^7.0.0"
"yargs-parser": "^7.0.0",
"word-wrap": "^1.2.3"
},
"devDependencies": {
"babel-changed": "^7.0.0",
@@ -50,8 +51,7 @@
"babel-preset-es2015": "^6.1.4",
"babel-preset-react": "^6.24.1",
"gettext-parser": "^1.2.2",
"jasmine": "^2.6.0",
"word-wrap": "^1.2.3"
"jasmine": "^2.6.0"
},
"scripts": {
"babelbuild": "babel app -d build",

View File

@@ -1 +1 @@
f38a6c5d97ddbb027b0d6e28d14545c8
26731ba0d38727c6c362b6d042517888

View File

@@ -2,6 +2,6 @@
set -e
CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@"
#bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes import-enex --fuzzy-matching /home/laurent/Desktop/afaire.enex afaire
#bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes import-enex --fuzzy-matching /home/laurent/Desktop/Laurent.enex laurent
#bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@"
bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --stack-trace-enabled --log-level debug "$@"

View File

@@ -90,8 +90,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion 16
targetSdkVersion 22
versionCode 41
versionName "0.9.28"
versionCode 43
versionName "0.9.30"
ndk {
abiFilters "armeabi-v7a", "x86"
}

View File

@@ -7,6 +7,7 @@ class FileApiDriverOneDrive {
constructor(api) {
this.api_ = api;
this.pathCache_ = {};
}
api() {
@@ -19,7 +20,7 @@ class FileApiDriverOneDrive {
itemFilter_() {
return {
select: 'name,file,folder,fileSystemInfo',
select: 'name,file,folder,fileSystemInfo,parentReference',
}
}
@@ -173,6 +174,13 @@ class FileApiDriverOneDrive {
throw new Error('Not implemented');
}
async pathDetails_(path) {
if (this.pathCache_[path]) return this.pathCache_[path];
let output = await this.api_.execJson('GET', path);
this.pathCache_[path] = output;
return this.pathCache_[path];
}
async delta(path, options = null) {
let output = {
hasMore: false,
@@ -180,6 +188,9 @@ class FileApiDriverOneDrive {
items: [],
};
let pathDetails = await this.pathDetails_(path);
const pathId = pathDetails.id;
let context = options ? options.context : null;
let url = context ? context.nextLink : null;
let query = null;
@@ -191,7 +202,23 @@ class FileApiDriverOneDrive {
}
let response = await this.api_.execJson('GET', url, query);
let items = this.makeItems_(response.value);
let items = [];
// The delta API might return things that happen in subdirectories of the root and we don't want to
// deal with these since all the files we're interested in are at the root (The .resource dir
// is special since it's managed directly by the clients and resources never change - only the
// associated .md file at the root is synced). So in the loop below we check that the parent is
// indeed the root, otherwise the item is skipped.
// (Not sure but it's possible the delta API also returns events for files that are copied outside
// of the app directory and later deleted or modified. We also don't want to deal with
// these files during sync).
for (let i = 0; i < response.value.length; i++) {
const v = response.value[i];
if (v.parentReference.id !== pathId) continue;
items.push(this.makeItem_(v));
}
output.items = output.items.concat(items);
let nextLink = null;