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

fix(share): Return empty string if no label is set #48673

Merged
merged 2 commits into from
Oct 14, 2024
Merged

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Oct 12, 2024

Summary

While the database supports NULL, the typing has always said it only returns string. So to not break any apps that might trust the typings we should return '' if the database is set to NULL.

Checklist

@susnux susnux added bug 3. to review Waiting for reviews php Pull requests that update Php code labels Oct 12, 2024
@susnux susnux added this to the Nextcloud 31 milestone Oct 12, 2024
@susnux susnux requested review from a team, Altahrim, sorbaugh and come-nc and removed request for a team October 12, 2024 15:54
@susnux
Copy link
Contributor Author

susnux commented Oct 12, 2024

/backport to stable30

@susnux susnux requested a review from provokateurin October 12, 2024 18:44
Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

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

Oh then you can actually revert #47551 where I thought this was intended but wrongly documented!
It was already broken before 30 as well, so please backport to 29 and 28 as well.

@susnux
Copy link
Contributor Author

susnux commented Oct 14, 2024

Oh then you can actually revert #47551 where I thought this was intended but wrongly documented!

I am not sure. The PHP documentation is only stating strings, but the DB accepts null. I personally think null is much better for representing the empty label then an empty string. But then again we would break some usage of the API if you trust the doc comments.

@come-nc
Copy link
Contributor

come-nc commented Oct 14, 2024

I thought some DB will treat null and empty string the same anyway and so we cannot differentiate in DB, no?

@provokateurin
Copy link
Member

Yeah, Oracle treats empty strings as NULL.
While I agree that it is nicer in the API to use null for a missing label we should fallback to an empty string to always have consistent behavior.

* Resolves: #48629

While the database supports NULL, the typing has always said it only returns *string*.
So to not break any apps that might trust the typings we should return `''` if the database is set to `NULL`.

Signed-off-by: Ferdinand Thiessen <[email protected]>
This reverts commit 01c4fa3.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux
Copy link
Contributor Author

susnux commented Oct 14, 2024

Oh then you can actually revert #47551 where I thought this was intended but wrongly documented!

Done

@susnux susnux merged commit b964e05 into master Oct 14, 2024
177 checks passed
@susnux susnux deleted the fix/null-label branch October 14, 2024 17:10
@susnux
Copy link
Contributor Author

susnux commented Oct 14, 2024

/backport to stable29

@provokateurin
Copy link
Member

@susnux not 28?

@susnux
Copy link
Contributor Author

susnux commented Oct 16, 2024

/backport to stable28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Sharing links with null labels broken after upgrade to NC-30
4 participants