WebDAV: Do not return shared calendars in home-set responses (#1796)

This commit is contained in:
mdecimus 2025-08-26 12:01:21 +02:00
parent 80633c3441
commit e20bdb71af
2 changed files with 15 additions and 5 deletions

View file

@ -1745,6 +1745,7 @@ async fn add_base_collection_response(
&access_token.name,
access_token.primary_id,
true,
false,
)
.await
.caused_by(trc::location!())?;
@ -1759,6 +1760,7 @@ async fn add_base_collection_response(
&access_token.name,
access_token.primary_id,
false,
false,
)
.await
.caused_by(trc::location!())?;

View file

@ -268,10 +268,16 @@ impl PrincipalPropFind for Server {
));
}
PrincipalProperty::CalendarHomeSet => {
let hrefs =
build_home_set(self, access_token, name.as_ref(), account_id, true)
.await
.caused_by(trc::location!())?;
let hrefs = build_home_set(
self,
access_token,
name.as_ref(),
account_id,
true,
false,
)
.await
.caused_by(trc::location!())?;
fields.push(DavPropertyValue::new(property.clone(), hrefs));
response.set_namespace(Namespace::CalDav);
@ -283,6 +289,7 @@ impl PrincipalPropFind for Server {
name.as_ref(),
account_id,
false,
false,
)
.await
.caused_by(trc::location!())?;
@ -412,6 +419,7 @@ pub(crate) async fn build_home_set(
name: &str,
account_id: u32,
is_calendar: bool,
include_sharings: bool,
) -> trc::Result<Vec<Href>> {
let (collection, resource_name) = if is_calendar {
(Collection::Calendar, DavResourceName::Cal)
@ -426,7 +434,7 @@ pub(crate) async fn build_home_set(
percent_encoding::utf8_percent_encode(name, RFC_3986),
)));
if account_id == access_token.primary_id() {
if include_sharings && account_id == access_token.primary_id() {
for account_id in access_token.all_ids_by_collection(collection) {
if account_id != access_token.primary_id() {
let other_name = server