Merge branch 'docker-fix-rename' into staging
commit
fcc54a3c34
|
@ -10,7 +10,7 @@
|
|||
"dependencies": {
|
||||
"chainpad-server": "~2.1.0",
|
||||
"express": "~4.16.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"fs-extra": "^7.0.0",
|
||||
"nthen": "~0.1.0",
|
||||
"pull-stream": "^3.6.1",
|
||||
"replify": "^1.2.0",
|
||||
|
|
13
rpc.js
13
rpc.js
|
@ -7,13 +7,14 @@ var Nacl = require("tweetnacl");
|
|||
/* globals process */
|
||||
|
||||
var Fs = require("fs");
|
||||
|
||||
var Fse = require("fs-extra");
|
||||
var Path = require("path");
|
||||
var Https = require("https");
|
||||
const Package = require('./package.json');
|
||||
const Pinned = require('./pinned');
|
||||
const Saferphore = require("saferphore");
|
||||
const nThen = require("nthen");
|
||||
const Mkdirp = require("mkdirp");
|
||||
|
||||
var RPC = module.exports;
|
||||
|
||||
|
@ -1054,7 +1055,7 @@ var upload_complete = function (Env, publicKey, id, cb) {
|
|||
}
|
||||
|
||||
// lol wut handle ur errors
|
||||
Fs.rename(oldPath, newPath, function (e) {
|
||||
Fse.move(oldPath, newPath, function (e) {
|
||||
if (e) {
|
||||
WARN('rename', e);
|
||||
return void cb('RENAME_ERR');
|
||||
|
@ -1146,7 +1147,7 @@ var owned_upload_complete = function (Env, safeKey, cb) {
|
|||
|
||||
// flow is dumb and I need to guard against this which will never happen
|
||||
// / *:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } * /
|
||||
Fs.rename(oldPath, finalPath, w(function (e) {
|
||||
Fs.move(oldPath, finalPath, w(function (e) {
|
||||
if (e) {
|
||||
w.abort();
|
||||
return void cb(e.code);
|
||||
|
@ -1218,13 +1219,13 @@ var owned_upload_complete = function (Env, safeKey, id, cb) {
|
|||
var finalOwnPath;
|
||||
nThen(function (w) {
|
||||
// make the requisite directory structure using Mkdirp
|
||||
Mkdirp(filePath, w(function (e /*, path */) {
|
||||
Fse.mkdirp(filePath, w(function (e /*, path */) {
|
||||
if (e) { // does not throw error if the directory already existed
|
||||
w.abort();
|
||||
return void cb(e.code);
|
||||
}
|
||||
}));
|
||||
Mkdirp(ownPath, w(function (e /*, path */) {
|
||||
Fse.mkdirp(ownPath, w(function (e /*, path */) {
|
||||
if (e) { // does not throw error if the directory already existed
|
||||
w.abort();
|
||||
return void cb(e.code);
|
||||
|
@ -1254,7 +1255,7 @@ var owned_upload_complete = function (Env, safeKey, id, cb) {
|
|||
|
||||
// flow is dumb and I need to guard against this which will never happen
|
||||
/*:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } */
|
||||
Fs.rename(oldPath, finalPath, w(function (e) {
|
||||
Fse.move(oldPath, finalPath, w(function (e) {
|
||||
if (e) {
|
||||
// Remove the ownership file
|
||||
Fs.unlink(finalOwnPath, function (e) {
|
||||
|
|
Loading…
Reference in New Issue