mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-12-23 22:46:44 +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) => {
|
||||
let status = statusTools.getStatus();
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
|
||||
@ -48,7 +48,7 @@ function getAddonList() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let status = statusTools.getStatus();
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ function getSnapshots() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let status = statusTools.getStatus();
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
|
||||
@ -215,7 +215,7 @@ function dellSnap(id) {
|
||||
checkSnap(id)
|
||||
.then(() => {
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
|
||||
@ -235,7 +235,7 @@ function dellSnap(id) {
|
||||
function checkSnap(id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
|
||||
@ -258,7 +258,7 @@ function createNewBackup(name) {
|
||||
getAddonToBackup().then((addons) => {
|
||||
let folders = getFolderToBackup();
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
timeout: {
|
||||
response: create_snap_timeout
|
||||
@ -332,7 +332,7 @@ function uploadSnapshot(path) {
|
||||
|
||||
let options = {
|
||||
body: form,
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
};
|
||||
|
||||
got.stream
|
||||
@ -386,7 +386,7 @@ function stopAddons() {
|
||||
statusTools.setStatus(status);
|
||||
let promises = [];
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
let addons_slug = settingsTools.getSettings().auto_stop_addon
|
||||
@ -426,7 +426,7 @@ function startAddons() {
|
||||
statusTools.setStatus(status);
|
||||
let promises = [];
|
||||
let option = {
|
||||
headers: { "Authorization": `Bearer ${token}` },
|
||||
headers: { "authorization": `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
};
|
||||
let addons_slug = settingsTools.getSettings().auto_stop_addon
|
||||
@ -473,7 +473,7 @@ function publish_state(state) {
|
||||
|
||||
|
||||
// let option = {
|
||||
// headers: { "Authorization": `Bearer ${token}` },
|
||||
// headers: { "authorization": `Bearer ${token}` },
|
||||
// responseType: "json",
|
||||
// json: data_error_sensor
|
||||
// };
|
||||
|
@ -214,6 +214,7 @@ class WebdavTools {
|
||||
statusTools.setStatus(status);
|
||||
logger.info("Uploading snap...");
|
||||
let tmpFile = `./temp/${id}.tar`;
|
||||
let stats = fs.statSync(tmpFile);
|
||||
let stream = fs.createReadStream(tmpFile);
|
||||
let conf = this.getConf();
|
||||
let options = {
|
||||
@ -221,7 +222,8 @@ class WebdavTools {
|
||||
// username: this.username,
|
||||
// password: encodeURIComponent(this.password),
|
||||
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") {
|
||||
@ -321,7 +323,7 @@ class WebdavTools {
|
||||
let conf = this.getConf();
|
||||
let options = {
|
||||
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") {
|
||||
|
Loading…
Reference in New Issue
Block a user