This PR updates the call to download a file from S3 to strip a leading forward slash, if it exists. While MinIO properly handles a path with an extra leading forward slash, S3 does not.
How can this be tested?
Note: Testing is similar to testing for https://github.com/mitodl/ocw-studio/pull/2081, except that the AWS storage is used instead of MinIO. This can be done by setting the following variables in the OCW Studio .env file:
ENVIRONMENT=<anything except `dev`>
AWS_ACCESS_KEY_ID=<use value from RC>
AWS_SECRET_ACCESS_KEY=<use value from RC>
AWS_STORAGE_BUCKET_NAME=<use value from RC>
Pick a legacy course that has no Google Drive content but does contain non-video resources for testing. An example is 24-915-linguistic-phonetics-fall-2015.
Spin up OCW Studio with docker compose up.
Run docker compose exec web ./manage.py backfill_gdrive_folder --filter <course name or short-id>.
Check the Google Drive folder for the website to ensure that the resources have been uploaded correctly. Also, check the Django admin to ensure that DriveFile objects have been created for each resource.
What are the relevant tickets?
Closes https://github.com/mitodl/ocw-studio/issues/2088.
Description (What does it do?)
This PR updates the call to download a file from S3 to strip a leading forward slash, if it exists. While MinIO properly handles a path with an extra leading forward slash, S3 does not.
How can this be tested?
Note: Testing is similar to testing for https://github.com/mitodl/ocw-studio/pull/2081, except that the AWS storage is used instead of MinIO. This can be done by setting the following variables in the OCW Studio
.env
file:24-915-linguistic-phonetics-fall-2015
.docker compose up
.docker compose exec web ./manage.py backfill_gdrive_folder --filter <course name or short-id>
.