Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add event to allow inspecting and changing multipart responses#1074

Merged
phil-davis merged 1 commit into
sabre-io:masterfrom
icewind1991:multistatus-hook
Apr 30, 2024
Merged

Add event to allow inspecting and changing multipart responses#1074
phil-davis merged 1 commit into
sabre-io:masterfrom
icewind1991:multistatus-hook

Conversation

@icewind1991
Copy link
Copy Markdown
Contributor

Use case for this is allowing caching/pagination of multipart responses.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 27, 2018

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.24%. Comparing base (97129a9) to head (a9fe8fc).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1074      +/-   ##
============================================
+ Coverage     97.22%   97.24%   +0.01%     
  Complexity     2834     2834              
============================================
  Files           175      175              
  Lines          9018     8843     -175     
============================================
- Hits           8768     8599     -169     
+ Misses          250      244       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DeepDiver1975
Copy link
Copy Markdown
Member

@icewind1991 Can I ask you for an example code snippet on how this event can be used?

I'm missing some logic which tells the code on what to do after the event was take care of or not.

THX

@icewind1991
Copy link
Copy Markdown
Contributor Author

My current use case for this is here: https://github.com/nextcloud/server/pull/10880/files#diff-a8ef54ad5b45404480feafc1de1eea28R62 where it stores a copy of the mutlipart listing result and limits the output returned.

@DeepDiver1975
Copy link
Copy Markdown
Member

My current use case for this is here: https://github.com/nextcloud/server/pull/10880/files#diff-a8ef54ad5b45404480feafc1de1eea28R62 where it stores a copy of the mutlipart listing result and limits the output returned.

I see you are using it for caching the dataset for later reuse - got it.

Why are you passing the properties by ref then?

@icewind1991
Copy link
Copy Markdown
Contributor Author

Because it also overwrites the returned properties to limit the number of results returned in the response.

@DeepDiver1975
Copy link
Copy Markdown
Member

Got it - THX

I was having trouble in the past as well with the missing capabilities to change the behavior of generateMultiStatus

What about a more generic approach where the whole method can be overwritten?

like emitting a generateMultiStatus event and in case not handled we fall back to the default implementation.

My use case was to chnage the content type from xml to json ...

@staabm what's our point on this? THX

@icewind1991
Copy link
Copy Markdown
Contributor Author

The ability to overwrite the method would also work yes, this was just the minimal approach I found

@DeepDiver1975
Copy link
Copy Markdown
Member

@icewind1991 how do we continue with this one?

@icewind1991
Copy link
Copy Markdown
Contributor Author

Rebased.

I would still like to have this merged as I believe that it provides a useful option for plugin authors at minimal cost.

@staabm staabm requested a review from phil-davis April 29, 2024 16:25
Copy link
Copy Markdown
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

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

LGTM

I will have a look through other pending sabre repo PRs over the next day or so, and probably make some releases "soon".

@phil-davis
Copy link
Copy Markdown
Contributor

Ported to the major version 4 release series in PR #1549

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.

4 participants