* Fix regex to account for fractional seconds. With thanks to @aagxxi  who provided the initial fix.
This commit is contained in:
abraunegg 2024-09-29 14:42:55 +10:00 committed by GitHub
commit 7c058361c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -124,7 +124,7 @@ Item makeDatabaseItem(JSONValue driveItem) {
}
}
}
// Set this item object type
bool typeSet = false;
if (isItemFile(driveItem)) {

View file

@ -528,7 +528,8 @@ bool isValidUTF16(string path) {
// Validate that the provided string is a valid date time stamp in UTC format
bool isValidUTCDateTime(string dateTimeString) {
// Regular expression for validating the string against UTC datetime format
auto pattern = regex(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$");
// Allows for an optional fractional second part (e.g., .123 or .123456789)
auto pattern = regex(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$");
// Validate for UTF-8 first
if (!isValidUTF8(dateTimeString)) {