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

PDS: Implemented Import Repo API #57

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TheRipperoni
Copy link
Contributor

@TheRipperoni TheRipperoni commented Feb 10, 2025

Implemented functionality to import your repo to RSky PDS.

Reasons users may want to do that include but are not limited to:

  1. A user is migrating to a given RSky PDS
  2. A user has already migrated, but has determined some outside data they would like to be included in their repo from another source

@TheRipperoni TheRipperoni changed the title PDS: Implemented Import Repo PDS: Implemented Import Repo API Feb 10, 2025
…ng the CarReader read the stream itself

- Added Unit tests for reading the car stream
@afbase
Copy link
Contributor

afbase commented Feb 13, 2025

See TheRipperoni#1

return Outcome::Error((Status::BadRequest, error));
}

let import_datastream = data.open(content_length.megabytes());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let import_datastream = data.open(content_length.megabytes());
let import_datastream = data.open(content_length.bytes());

"Content-Length is greater than maximum of {max_import_size}"
));
req.local_cache(|| Some(error.clone()));
return Outcome::Error((Status::BadRequest, error));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return Outcome::Error((Status::BadRequest, error));
return Outcome::Error((Status::PayloadTooLarge, error));

None => {
let error = ApiError::InvalidRequest("Missing content-length header".to_string());
req.local_cache(|| Some(error.clone()));
Outcome::Error((Status::BadRequest, error))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Outcome::Error((Status::BadRequest, error))
Outcome::Error((Status::LengthRequired, error))

req.local_cache(|| Some(error.clone()));
Outcome::Error((Status::BadRequest, error))
}
Some(res) => match res.parse::<usize>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is a little pedantic but perhaps worthwhile using the NonZeroU64.

I have an example in the PR I made.

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.

2 participants