You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "universalmind303 (via GitHub)" <gi...@apache.org> on 2023/09/18 22:52:39 UTC

[GitHub] [arrow-rs] universalmind303 commented on a diff in pull request #4834: fix: object store http header last modified

universalmind303 commented on code in PR #4834:
URL: https://github.com/apache/arrow-rs/pull/4834#discussion_r1329358102


##########
object_store/src/client/header.rs:
##########
@@ -53,19 +53,22 @@ pub enum Error {
 
 /// Extracts [`ObjectMeta`] from the provided [`HeaderMap`]
 pub fn header_meta(location: &Path, headers: &HeaderMap) -> Result<ObjectMeta, Error> {
-    let last_modified = headers
-        .get(LAST_MODIFIED)
-        .context(MissingLastModifiedSnafu)?;
+    let last_modified = headers.get(LAST_MODIFIED);
+    let last_modified = match last_modified {
+        Some(last_modified) => {
+            let last_modified = last_modified.to_str().context(BadHeaderSnafu)?;
+            DateTime::parse_from_rfc2822(last_modified)
+                .context(InvalidLastModifiedSnafu { last_modified })?
+                .with_timezone(&Utc)
+        }
+        // If the last modified header is missing, assume the object was created at the epoch
+        None => chrono::Utc.timestamp_nanos(0),

Review Comment:
   I think the deprecation was for `Datetime::timestamp_nanos` not `TimeZone::timestamp_nanos`. There doesn't appear to be a `TimeZone::timestamp_nanos_opt`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org