Skip to content

Inconsistency in etag calculation #37

Description

@untitaker
  • When listing items by doing GET /foldername/ the mtime of file.txt is used.
  • When fetching items by doing GET /foldername/file.txt, the mtime of .~file.txt is used.

I guess this issue doesn't always show up because the file has to be PUT at a second (or millisecond?) boundary, otherwise there's no difference between the mtime of the meta file and the mtime of the data file. However, you can test it by touching either meta files or data files.

The following patch fixes this:

diff --git a/lib/stores/file_tree.js b/lib/stores/file_tree.js
index 465f9ce..abb3b6c 100644
--- a/lib/stores/file_tree.js
+++ b/lib/stores/file_tree.js
@@ -184,7 +184,7 @@ FileTree.prototype.get = function(username, path, version, callback) {
       });
     } else {
       self.readFile(dataPath, function(error, blob, modified) {
-        self.readFile(metaPath, function(error, json, modified) {
+        self.readFile(metaPath, function(error, json, _) {
           if (error) {
             release();
             return callback(null, null);

I'll open a PR if you agree with the change @jcoglan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions