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

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

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


##########
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:
   IIRC this method is deprecated and you will need to use 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