Skip to content
This repository has been archived by the owner on Jun 4, 2018. It is now read-only.

add timestamp in file name #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions [email protected]/components/nsSeaFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var gServerUrl = "";
var kAuthPath = "api2/auth-token/";
var kUserInfoPath = "api2/account/info/";
var kRepoPath = "api2/repos/";
var TS;

function nsSeaFile() {
this.log = Log4Moz.getConfiguredLogger("SeaFile","DEBUG","DEBUG");
Expand Down Expand Up @@ -177,6 +178,7 @@ nsSeaFile.prototype = {
* stop states of the upload procedure.
*/
uploadFile: function nsSeaFile_uploadFile( aFile, aCallback) {
TS = Date.now();
if (Services.io.offline)
throw Ci.nsIMsgCloudFileProvider.offlineErr;

Expand Down Expand Up @@ -1149,7 +1151,7 @@ nsSeaFileFileUploader.prototype = {
//let fileName = /^[\040-\176]+$/.test(this.file.leafName)
// ? this.file.leafName
// : encodeURIComponent(this.file.leafName);
let fileName = this.file.leafName;
let fileName = TS+'_'+this.file.leafName;
let fileContents = "--" + boundary +
"\r\nContent-Disposition: form-data; name=\"parent_dir\"\r\n\r\n"+
this.folderName+"\r\n"+
Expand Down Expand Up @@ -1285,7 +1287,7 @@ nsSeaFileFileUploader.prototype = {
// ? this.file.leafName
// : encodeURIComponent(this.file.leafName);
let fileName = this.file.leafName;
req.send("p="+this.folderName+"/"+fileName);
req.send("p="+this.folderName+"/"+TS+'_'+fileName);
},

/**
Expand Down