chromium / axiom

Axiom Project
https://chromium.github.io/axiom/web_shell/
Apache License 2.0
53 stars 26 forks source link

GDrive FS: refresh auth on every external access #107

Closed ussuri closed 9 years ago

ussuri commented 9 years ago

@rpaquay

Includes a small refactoring that makes the above easier to use.

rpaquay commented 9 years ago

lgtm

Nit: I would prefer avoiding the runCommand_ function, leaving path validation inside each method, and composing promises in a more natural way, so that each function looks more "self-explanatory".

For example, the version of the stat function below looks cleaner imho:

GDriveFileSystem.prototype.stat = function(path) {
  if (!this.isValidPath_(path))
    return Promise.reject(new AxiomError.Invalid('path', path.originalSpec));

  return this.refreshOnline().then(function() {
    return gdrivefsUtil.statEntry(path);
  });
};
ussuri commented 9 years ago

As we've discussed, this is the gray area of generic vs. concrete. My other pending PRs depend on the code as it is here, so I'll land all of them, and then maybe redo the code to be somewhere in the middle between the two approaches.