Remove unused code

This commit is contained in:
Lennart K
2026-01-08 23:24:47 +01:00
parent 276fdcacf5
commit c77b59dcb0
4 changed files with 51 additions and 27 deletions

View File

@@ -1,7 +1,5 @@
use axum::{http::StatusCode, response::IntoResponse}; use axum::{http::StatusCode, response::IntoResponse};
use crate::CalDateTimeError;
#[derive(Debug, thiserror::Error, PartialEq, Eq)] #[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum Error { pub enum Error {
#[error("Invalid ics/vcf input: {0}")] #[error("Invalid ics/vcf input: {0}")]
@@ -15,12 +13,6 @@ pub enum Error {
#[error(transparent)] #[error(transparent)]
ParserError(#[from] ical::parser::ParserError), ParserError(#[from] ical::parser::ParserError),
#[error(transparent)]
CalDateTimeError(#[from] CalDateTimeError),
#[error(transparent)]
RRuleError(#[from] rrule::RRuleError),
} }
impl Error { impl Error {
@@ -30,7 +22,7 @@ impl Error {
Self::InvalidData(_) | Self::MissingCalendar | Self::MissingContact => { Self::InvalidData(_) | Self::MissingCalendar | Self::MissingContact => {
StatusCode::BAD_REQUEST StatusCode::BAD_REQUEST
} }
_ => StatusCode::INTERNAL_SERVER_ERROR, Self::ParserError(_) => StatusCode::INTERNAL_SERVER_ERROR,
} }
} }
} }

View File

@@ -4,24 +4,6 @@ use rustical_xml::{ValueDeserialize, ValueSerialize};
const UTC_DATE_TIME: &str = "%Y%m%dT%H%M%SZ"; const UTC_DATE_TIME: &str = "%Y%m%dT%H%M%SZ";
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum CalDateTimeError {
#[error(
"Timezone has X-LIC-LOCATION property to specify a timezone from the Olson database, however its value {0} is invalid"
)]
InvalidOlson(String),
#[error("TZID {0} does not refer to a valid timezone")]
InvalidTZID(String),
#[error("Timestamp doesn't exist because of gap in local time")]
LocalTimeGap,
#[error("Datetime string {0} has an invalid format")]
InvalidDatetimeFormat(String),
#[error("Could not parse datetime {0}")]
ParseError(String),
#[error("Duration string {0} has an invalid format")]
InvalidDurationFormat(String),
}
#[derive(Debug, Clone, Deref, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Deref, PartialEq, Eq, Hash)]
pub struct UtcDateTime(pub DateTime<Utc>); pub struct UtcDateTime(pub DateTime<Utc>);

View File

@@ -0,0 +1,14 @@
---
source: src/integration_tests/caldav/calendar.rs
assertion_line: 145
expression: body
---
BEGIN:VCALENDAR
VERSION:2.0
PRODID:RustiCal Export
CALSCALE:GREGORIAN
X-WR-CALNAME:Calendar
X-WR-CALDESC:Description
X-WR-CALCOLOR:#00FF00
X-WR-TIMEZONE:US/Eastern
END:VCALENDAR

View File

@@ -0,0 +1,36 @@
---
source: src/integration_tests/carddav/addressbook.rs
assertion_line: 446
expression: body
---
<?xml version="1.0" encoding="utf-8"?>
<multistatus xmlns="DAV:" xmlns:CAL="urn:ietf:params:xml:ns:caldav" xmlns:CARD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/" xmlns:PUSH="https://bitfire.at/webdav-push">
<response>
<href>/carddav/principal/user/contacts/newcard.vcf</href>
<propstat>
<prop>
<getetag>&quot;ea0bf4a2ce7ef84606a4cf9235776dbc11b3e7ce351ddf35f27cbc0088acca7e&quot;</getetag>
<CARD:address-data>BEGIN:VCARD
VERSION:3.0
FN:Cyrus Daboo
N:Daboo;Cyrus
ADR;TYPE=POSTAL:;2822 Email HQ;Suite 2821;RFCVille;PA;15213;USA
EMAIL;TYPE=INTERNET,PREF:cyrus@example.com
NICKNAME:me
NOTE:Example VCard.
ORG:Self Employed
TEL;TYPE=WORK,VOICE:412 605 0499
TEL;TYPE=FAX:412 605 0705
URL:http://www.example.com
UID:1234-5678-9000-1
END:VCARD
</CARD:address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/home/bernard/addressbook/vcf1.vcf</href>
<status>HTTP/1.1 404 Not Found</status>
</response>
</multistatus>