mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-15 21:04:46 +01:00
bugfix (#6): fix webdav backend to allow binary files
This commit is contained in:
parent
c33f10707b
commit
5437dab0d7
3 changed files with 6 additions and 15 deletions
|
|
@ -125,9 +125,6 @@ export class Editor extends React.Component {
|
|||
mode = 'text';
|
||||
}
|
||||
|
||||
// haskell
|
||||
|
||||
console.log(mode)
|
||||
return import(/* webpackChunkName: "editor" */'../pages/viewerpage/editor/'+mode)
|
||||
.then((module) => Promise.resolve(module.default));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ app.post('/cat', function(req, res){
|
|||
part.on('error', function(err){
|
||||
res.send({status: 'error', message: 'internal error'})
|
||||
});
|
||||
|
||||
|
||||
Files.write(path, part, req.cookies.auth)
|
||||
.then(function(result){
|
||||
res.send({status: 'ok'});
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ module.exports = {
|
|||
cat: function(path, params){
|
||||
path = encode(path);
|
||||
return new Promise(function(done, err){
|
||||
//path.replace(/\#/g, '%23')
|
||||
connect(params).readFile(path, 'binary', function(error, res){
|
||||
if(error){ err(error) }
|
||||
else{
|
||||
|
|
@ -45,8 +44,6 @@ module.exports = {
|
|||
},
|
||||
ls: function(path, params){
|
||||
return new Promise((done, err) => {
|
||||
//path = encode(path);
|
||||
//console.log(path)
|
||||
connect(params).readdir(path, function(error, contents) {
|
||||
if (!error) {
|
||||
done(contents.map((content) => {
|
||||
|
|
@ -73,15 +70,12 @@ module.exports = {
|
|||
},
|
||||
write: function(path, content, params){
|
||||
path = encode(path);
|
||||
return toString(content)
|
||||
.then((content) => {
|
||||
return new Promise((done, err) => {
|
||||
connect(params).writeFile(path, content, function(error) {
|
||||
if(error){ err(error); }
|
||||
else{ done('done'); }
|
||||
});
|
||||
});
|
||||
return new Promise((done, err) => {
|
||||
connect(params).writeFile(path, content, 'binary', function(error) {
|
||||
if(error){ err(error); }
|
||||
else{ done('done'); }
|
||||
});
|
||||
});
|
||||
},
|
||||
rm: function(path, params){
|
||||
path = encode(path);
|
||||
|
|
|
|||
Loading…
Reference in a new issue