Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-standard time format #177

Merged
merged 1 commit into from Jun 10, 2023
Merged

Support non-standard time format #177

merged 1 commit into from Jun 10, 2023

Conversation

joec4i
Copy link
Contributor

@joec4i joec4i commented Aug 26, 2022

We are working with a Swift backend server that returns last_modified formatted as 2022-08-18T04:02:34Z instead of 2022-08-18T04:02:34 . Because of that, the Objects() call returns the following error:

parsing time "2022-08-18T04:02:34Z": extra text: "Z"

As per the OpenStack Storage API reference,

The date and time stamp format is ISO 8601:

2022-08-18T04:02:34Z appears to be a valid ISO 8601 format according to wikipedia.

The easiest way to support it is probably to make time format a setting that can be changed by the user. This PR does that.

This removes the Z suffix from object.ServerLastModified before using it.

Please review.

Thanks!

@ncw
Copy link
Owner

ncw commented Sep 16, 2022

I would be included just to remove a trailing Z if it exists - then the code will adapt to either format with no configuration.

@joec4i
Copy link
Contributor Author

joec4i commented Sep 19, 2022

I would be included just to remove a trailing Z if it exists - then the code will adapt to either format with no configuration.

Hmm yeah that's better. Thanks @ncw . It's updated now. Please have another look. Note: I didn't add a new test case because it's too much trouble to make the test server return time with a trailing Z. The existing test TestObjects() should still pass though.

@joec4i
Copy link
Contributor Author

joec4i commented May 15, 2023

Hi @ncw Any chance we can get this in? 🙏 🙏

Copy link
Owner

@ncw ncw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good.

Let me try the CI

@ncw ncw merged commit e570216 into ncw:master Jun 10, 2023
@ncw
Copy link
Owner

ncw commented Jun 10, 2023

Thank you :-)

nono added a commit to cozy/cozy-stack that referenced this pull request Jun 19, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/ncw/swift/v2](https://togithub.com/ncw/swift) | require |
patch | `v2.0.1` -> `v2.0.2` |

---

### Release Notes

<details>
<summary>ncw/swift</summary>

### [`v2.0.2`](https://togithub.com/ncw/swift/releases/tag/v2.0.2)

[Compare Source](https://togithub.com/ncw/swift/compare/v2.0.1...v2.0.2)

#### What's Changed

- Support non-standard time format by
[@&#8203;joec4i](https://togithub.com/joec4i) in
[ncw/swift#177

#### New Contributors

- [@&#8203;joec4i](https://togithub.com/joec4i) made their first
contribution in
[ncw/swift#177

**Full Changelog**: ncw/swift@v2.0.1...v2.0.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 6am on Monday" in timezone
Europe/Paris, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/cozy/cozy-stack).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMjYuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEyNi4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants