Commits

Liam Staskawicz  committed 4c988ca

* small tweaks

  • Participants
  • Parent commits a970473

Comments (0)

Files changed (2)

File fan/gridfs/GridFSFile.fan

   Int saveRawData(InStream ins)
   {
     b := Buf(GridFS.DEFAULT_CHUNK_SIZE)
-    total := 0
+    _size = 0
     chunkNum := 0
     
     // todo - calculate md5 as we go...something like the following in java
           break
         }
         else
-          total += v
+          _size += v
       }
       
       gfs.chunkColl.save(["files_id": _id, "n": chunkNum++, "data": b.flip])
       b.clear
     }
-    _size = total
     savedChunks = true
     return chunkNum
   }

File test/GridFSTest.fan

       // TODO - also check for md5 when implemented
     }
     
+    verifyNull(gfs.findOneByName("somegarbage"))
+    
     f3 := gfs.findOneByName("tester1")
     verifyNotNull(f3)
     sb := Buf() // have to read to a Buf first since StrBuf won't allow writeBuf() on it
     path[path.size - 1] = "ReadBack${bigfile.name}"
     leading := bigfile.uri.isPathAbs ? File.sep : "" // need to re-add the leading slash?
     readbackfile := File(Uri.fromStr("${leading}${path.join(File.sep)}"))
+    if(readbackfile.exists)
+      readbackfile.delete
     verify(readbackfile.parent == bigfile.parent)
     fmp3 := gfs.findOneByName("bigfiletest")
     verifyNotNull(fmp3)