-
Notifications
You must be signed in to change notification settings - Fork 11
Crash on Import #2
Copy link
Copy link
Closed
Labels
Description
I have a strange crash on import whilst importing a Login record.
I have copied the 1PIF data below obviously removing sensitive data
{"uuid":"UUID VALUE",
"createdAt":1461778322727, <-------------- This is bigger than usual!
"updatedAt":1461778930,
"title":"TITLE TEXT",
"typeName":
"webforms.WebForm",
"securityLevel":"SL5",
"openContents":{"contentsHash":"hashvalue","securityLevel":"SL5"},
"contentsHash":"hashvalue",
"secureContents":{
"fields":[
{"name":"Username","designation":"username","value":"usernamevalue"},
{"name":"Password","designation":"password","value":"passwordvalue"}
],
"notesPlain":"Some Text"
}
}
As you can see for some reason the createdAt is represented in Milliseconds, this results in a crash at
DateTimeExt at
dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();
I have no idea why this export contains that value as all the others seemed to be OK but I applied this simple fix to DateTimeExt.cs FromUnixTimeStamp to resolve in my local copy and wanted to share it with you.
if (unixTimeStamp > 20000000000)
{
dtDateTime = dtDateTime.AddMilliseconds(unixTimeStamp).ToLocalTime();
}
else
{
dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();
}
If the value is < 20000000000 then a date up to 2603 can be supported, if greater than 20000000000 then it will assume Milliseconds and therefore an earliest date of Aug 1970.
Reactions are currently unavailable