-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b591429
commit 2cb0430
Showing
15 changed files
with
182 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { MethodCallArgs } from '../WebDAVRequest'; | ||
export default function (arg: MethodCallArgs, callback: any): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var WebDAVRequest_1 = require("../WebDAVRequest"); | ||
var FSManager_1 = require("../../manager/FSManager"); | ||
function default_1(arg, callback) { | ||
arg.getResource(function (e, r) { | ||
if (e) { | ||
arg.setCode(WebDAVRequest_1.HTTPCodes.NotFound); | ||
callback(); | ||
return; | ||
} | ||
var override = arg.findHeader('overwrite') === 'T'; | ||
var destination = arg.findHeader('destination'); | ||
if (!destination) { | ||
arg.setCode(WebDAVRequest_1.HTTPCodes.BadRequest); | ||
callback(); | ||
return; | ||
} | ||
destination = destination.substring(destination.indexOf('://') + '://'.length); | ||
destination = destination.substring(destination.indexOf('/')); | ||
destination = new FSManager_1.FSPath(destination); | ||
arg.server.getResourceFromPath(destination.getParent(), function (e, rDest) { | ||
r.moveTo(rDest, destination.fileName(), override, function (e) { | ||
if (e) | ||
arg.setCode(WebDAVRequest_1.HTTPCodes.InternalServerError); | ||
else | ||
arg.setCode(WebDAVRequest_1.HTTPCodes.Created); | ||
callback(); | ||
}); | ||
}); | ||
}); | ||
} | ||
exports.default = default_1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { HTTPCodes, MethodCallArgs, WebDAVRequest } from '../WebDAVRequest' | ||
import { IResource, ResourceType } from '../../resource/Resource' | ||
import { FSPath } from '../../manager/FSManager' | ||
|
||
export default function(arg : MethodCallArgs, callback) | ||
{ | ||
arg.getResource((e, r) => { | ||
if(e) | ||
{ | ||
arg.setCode(HTTPCodes.NotFound) | ||
callback(); | ||
return; | ||
} | ||
|
||
const override = arg.findHeader('overwrite') === 'T'; | ||
|
||
let destination : any = arg.findHeader('destination'); | ||
if(!destination) | ||
{ | ||
arg.setCode(HTTPCodes.BadRequest); | ||
callback(); | ||
return; | ||
} | ||
|
||
destination = destination.substring(destination.indexOf('://') + '://'.length) | ||
destination = destination.substring(destination.indexOf('/')) | ||
destination = new FSPath(destination) | ||
|
||
arg.server.getResourceFromPath(destination.getParent(), (e, rDest) => { | ||
r.moveTo(rDest, destination.fileName(), override, (e) => { | ||
if(e) | ||
arg.setCode(HTTPCodes.InternalServerError) | ||
else | ||
arg.setCode(HTTPCodes.Created) | ||
callback() | ||
}) | ||
}) | ||
}) | ||
} |