fix: use ISO-8601 format for share expiration dates#16
Open
zerox80 wants to merge 2 commits into
Open
Conversation
c6bbbda to
929d7ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change updates the formatting of the share expiration date (
expireDate) sent by the Android app when creating or updating shares. Currently, the app formats the date as"yyyy-MM-dd".While the public link sharing endpoint in the backend has a fallback that parses this date-only format, the endpoints for private shares (user/group shares) and space membership do not.
Specifically:
createUserShare(inuser.go) expects_iso8601 = "2006-01-02T15:04:05Z0700".updateShare(inshares.go) expectstime.RFC3339("2006-01-02T15:04:05Z07:00").addSpaceMember(inspaces.go) expects either layout.Because
"yyyy-MM-dd"doesn't match either pattern, creating or updating a private share or space membership with an expiration date always fails with anHTTP 400 Bad Request("could not parse expireDate").To resolve this without needing backend changes, this PR updates both
CreateRemoteShareOperationandUpdateRemoteShareOperationto format the expiration timestamp as a standard UTC ISO-8601 string ("yyyy-MM-dd'T'HH:mm:ss'Z'"), which parses successfully across all backend endpoints.Note
Although the Android app's user interface (
EditPrivateShareFragment) does not currently expose setting expiration dates for private shares, the core SDK library classes (CreateRemoteShareOperationandUpdateRemoteShareOperation) are designed to handle them. This patch is necessary to ensure that when the private share expiration feature is implemented in the mobile UI, these SDK operations do not trigger400 Bad Requesterrors on the backend.Changes
FORMAT_EXPIRATION_DATEpattern to"yyyy-MM-dd'T'HH:mm:ss'Z'"inCreateRemoteShareOperation.ktandUpdateRemoteShareOperation.kt.SimpleDateFormatto use theUTCtimezone.