mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-19 22:26:37 +02:00
Fix application crash due to invalid UTF-8 sequence in the pathname for the application configuration (#1551)
* Catch a Invalid UTF-8 handling error when attempting to initialise the application. This is caused by the 'path' to the application configuration (typically ~/.config/onedrive) contains a bad UTF-8 character thus cannot be read / initialised
This commit is contained in:
parent
fc5d7f9327
commit
54a6575709
|
@ -375,6 +375,7 @@ final class OneDriveApi
|
||||||
|
|
||||||
bool init()
|
bool init()
|
||||||
{
|
{
|
||||||
|
static import std.utf;
|
||||||
// detail what we are using for applicaion identification
|
// detail what we are using for applicaion identification
|
||||||
log.vdebug("clientId = ", clientId);
|
log.vdebug("clientId = ", clientId);
|
||||||
log.vdebug("companyName = ", companyName);
|
log.vdebug("companyName = ", companyName);
|
||||||
|
@ -400,6 +401,11 @@ final class OneDriveApi
|
||||||
log.error("Cannot authorize with Microsoft OneDrive Service");
|
log.error("Cannot authorize with Microsoft OneDrive Service");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} catch (std.utf.UTFException e) {
|
||||||
|
// path contains characters which generate a UTF exception
|
||||||
|
log.error("Cannot read refreshToken from: ", cfg.refreshTokenFilePath);
|
||||||
|
log.error(" Error Reason:", e.msg);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -409,6 +415,11 @@ final class OneDriveApi
|
||||||
refreshToken = readText(cfg.refreshTokenFilePath);
|
refreshToken = readText(cfg.refreshTokenFilePath);
|
||||||
} catch (FileException e) {
|
} catch (FileException e) {
|
||||||
return authorize();
|
return authorize();
|
||||||
|
} catch (std.utf.UTFException e) {
|
||||||
|
// path contains characters which generate a UTF exception
|
||||||
|
log.error("Cannot read refreshToken from: ", cfg.refreshTokenFilePath);
|
||||||
|
log.error(" Error Reason:", e.msg);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue