improve (edge case): code maintenance

This commit is contained in:
Mickael KERJEAN
2019-02-18 18:33:46 +11:00
parent 39441d4a5e
commit 7f820b8cd4
3 changed files with 3 additions and 13 deletions

View File

@ -156,7 +156,7 @@ const FormElement = (props) => {
value = value === "" ? null : parseInt(value);
props.onChange(value);
};
$input = ( <Input onChange={(e) => onNumberChange(e.target.value)} {...id} name={struct.label} type="number" value={struct.value || ""} placeholder={struct.placeholder} /> );
$input = ( <Input onChange={(e) => onNumberChange(e.target.value)} {...id} name={struct.label} type="number" value={struct.value === null ? "" : struct.value} placeholder={struct.placeholder} /> );
break;
case "password":
const onPasswordChange = (value) => {

View File

@ -176,18 +176,6 @@ class FileSystem{
file.last_access = new Date();
return file;
}).then((response) => Promise.resolve(response.result));
})
.catch((err) => {
if(err.code === 'BINARY_FILE') return Promise.reject(err);
return cache.update(cache.FILE_CONTENT, [currentShare(), path], (response) => {
response.last_access = new Date();
response.access_count += 1;
return response;
}).then((response) => {
if(!response || !response.result) return Promise.reject(err);
return Promise.resolve(response.result);
});
});
}

View File

@ -51,6 +51,8 @@ func SendErrorResult(res http.ResponseWriter, err error) {
obj, ok := err.(interface{ Status() int })
if ok == true {
res.WriteHeader(obj.Status())
} else {
res.WriteHeader(http.StatusInternalServerError)
}
m := func(r string) string {
if r == "" {