mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 09:12:58 +01:00
🚑 Add missing 'content-length' header (possible fix for #135)
This commit is contained in:
parent
065bfae223
commit
4622a36f1b
@ -22,7 +22,7 @@ function getVersion() {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let status = statusTools.getStatus();
|
let status = statusTools.getStatus();
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ function getAddonList() {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let status = statusTools.getStatus();
|
let status = statusTools.getStatus();
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ function getSnapshots() {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let status = statusTools.getStatus();
|
let status = statusTools.getStatus();
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ function dellSnap(id) {
|
|||||||
checkSnap(id)
|
checkSnap(id)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ function dellSnap(id) {
|
|||||||
function checkSnap(id) {
|
function checkSnap(id) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ function createNewBackup(name) {
|
|||||||
getAddonToBackup().then((addons) => {
|
getAddonToBackup().then((addons) => {
|
||||||
let folders = getFolderToBackup();
|
let folders = getFolderToBackup();
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
timeout: {
|
timeout: {
|
||||||
response: create_snap_timeout
|
response: create_snap_timeout
|
||||||
@ -332,7 +332,7 @@ function uploadSnapshot(path) {
|
|||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
body: form,
|
body: form,
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
};
|
};
|
||||||
|
|
||||||
got.stream
|
got.stream
|
||||||
@ -386,7 +386,7 @@ function stopAddons() {
|
|||||||
statusTools.setStatus(status);
|
statusTools.setStatus(status);
|
||||||
let promises = [];
|
let promises = [];
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
let addons_slug = settingsTools.getSettings().auto_stop_addon
|
let addons_slug = settingsTools.getSettings().auto_stop_addon
|
||||||
@ -426,7 +426,7 @@ function startAddons() {
|
|||||||
statusTools.setStatus(status);
|
statusTools.setStatus(status);
|
||||||
let promises = [];
|
let promises = [];
|
||||||
let option = {
|
let option = {
|
||||||
headers: { "Authorization": `Bearer ${token}` },
|
headers: { "authorization": `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
};
|
};
|
||||||
let addons_slug = settingsTools.getSettings().auto_stop_addon
|
let addons_slug = settingsTools.getSettings().auto_stop_addon
|
||||||
@ -473,7 +473,7 @@ function publish_state(state) {
|
|||||||
|
|
||||||
|
|
||||||
// let option = {
|
// let option = {
|
||||||
// headers: { "Authorization": `Bearer ${token}` },
|
// headers: { "authorization": `Bearer ${token}` },
|
||||||
// responseType: "json",
|
// responseType: "json",
|
||||||
// json: data_error_sensor
|
// json: data_error_sensor
|
||||||
// };
|
// };
|
||||||
|
@ -214,6 +214,7 @@ class WebdavTools {
|
|||||||
statusTools.setStatus(status);
|
statusTools.setStatus(status);
|
||||||
logger.info("Uploading snap...");
|
logger.info("Uploading snap...");
|
||||||
let tmpFile = `./temp/${id}.tar`;
|
let tmpFile = `./temp/${id}.tar`;
|
||||||
|
let stats = fs.statSync(tmpFile);
|
||||||
let stream = fs.createReadStream(tmpFile);
|
let stream = fs.createReadStream(tmpFile);
|
||||||
let conf = this.getConf();
|
let conf = this.getConf();
|
||||||
let options = {
|
let options = {
|
||||||
@ -221,7 +222,8 @@ class WebdavTools {
|
|||||||
// username: this.username,
|
// username: this.username,
|
||||||
// password: encodeURIComponent(this.password),
|
// password: encodeURIComponent(this.password),
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64')
|
'authorization': 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64'),
|
||||||
|
'content-length': String(stats.size)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (conf.ssl === "true") {
|
if (conf.ssl === "true") {
|
||||||
@ -321,7 +323,7 @@ class WebdavTools {
|
|||||||
let conf = this.getConf();
|
let conf = this.getConf();
|
||||||
let options = {
|
let options = {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64')
|
'authorization': 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (conf.ssl === "true") {
|
if (conf.ssl === "true") {
|
||||||
|
Loading…
Reference in New Issue
Block a user