mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-17 17:56:27 +00:00
Fixes custom certificate upload
This commit is contained in:
@ -139,7 +139,11 @@ function FileUpload(path, fd) {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status !== 200 && xhr.status !== 201) {
|
||||
reject(new Error('Upload failed: ' + xhr.status));
|
||||
try {
|
||||
reject(new Error('Upload failed: ' + JSON.parse(xhr.responseText).error.message));
|
||||
} catch (err) {
|
||||
reject(new Error('Upload failed: ' + xhr.status));
|
||||
}
|
||||
} else {
|
||||
resolve(xhr.responseText);
|
||||
}
|
||||
@ -587,7 +591,8 @@ module.exports = {
|
||||
* @param {Object} data
|
||||
*/
|
||||
create: function (data) {
|
||||
const timeout = 180000 + (data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) * 1000 : 0);
|
||||
|
||||
const timeout = 180000 + (data && data.meta && data.meta.propagation_seconds ? Number(data.meta.propagation_seconds) * 1000 : 0);
|
||||
return fetch('post', 'nginx/certificates', data, {timeout});
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user