Comments (5)
Ahh, it seems if it is set @ upload / write time, then this is indeed a bandersnatch bug. Nice find.
I'm asking on the issue if there are plans for a friendlier API and how do we edit existing files ContentType ...
from bandersnatch.
This is definitely a serving configuration issue. You need to make the Content-Type:
s3 HTML headers send text/html
if you're serving a index.html or application/vnd.pypi.simple.v1+json
if you're seeing the json file to make pip happy ...
My quick search (linked above) says there is no default and you're somehow sending Content-Type: binary/octet-stream
. So correcting that should help fix the issue.
I'm happy to take documentation updates to https://bandersnatch.readthedocs.io/en/latest/storage_options.html#amazon-s3 - Source file if you feel our docs are lacking. I've sadly never setup a S3 based mirror so can not help much more here.
from bandersnatch.
I've taken a second look at things with a fresh pair of eyes. Think you pointed in the right direction with the Content-Type
.
From what I can tell the bandersnatch s3 plugin isn't specifying a Mime type when doing a PutObject
to S3, which results in AWS giving the object the default of binary/octet-stream
:
aws s3api head-object --bucket <bucketname> --key web/simple/index.html
{
"AcceptRanges": "bytes",
"LastModified": "2023-11-27T12:24:18+00:00",
"ContentLength": 422,
"ETag": omitted,
"ContentType": "binary/octet-stream",
"ServerSideEncryption": "AES256",
"Metadata": {}
}
From some surface level digging it looks like S3Path
is being used to get the files to S3 and there's conversation about passing the Content-Type
as a parameter in an existing issue:
I sadly lack the talent and knowledge on bandersnatch to know how to go about fixing things. (If what I mention sounds right)
from bandersnatch.
You can use a CDN to provide service, which could be cheaper and content-type can also be changed
Use https://github.com/pottava/aws-s3-proxy and nginx to set content-type if you're using this for internal use only.
from bandersnatch.
I also encountered this bug in the s3 server... until it's fixed I had to do a recursive fix of the content-types of the index.html pages in my bucket:
aws s3 cp \
s3://MY_BUCKET/data/web/simple/ \
s3://MY_BUCKET/data/web/simple/ \
--exclude '*' \
--include '*.html' \
--no-guess-mime-type \
--content-type="text/html" \
--metadata-directive="REPLACE" \
--recursive
from bandersnatch.
Related Issues (20)
- Since the Bump s3path from 0.4.2 to 0.5.0 HOT 2
- package exist on pypi but not sync HOT 8
- Clean/verify packages in another way HOT 5
- Test bandersnatch in 3.12 + cut over docker HOT 1
- Move CI back to latest python once aiohttp supports 3.12 HOT 1
- Latest x releases: version sorting broken HOT 3
- Latest x packages breaks pinned version functionality HOT 1
- HTTP(S) Proxy Support HOT 10
- bandersnatch mirror completeness HOT 12
- bandersnatch repeatedly executes synchronously but keeps getting stuck on the same package(this time is mpf) HOT 6
- Incremental Synchronization Issue with Bandersnatch HOT 2
- Can I edit the file "todo"? I encountered a lot of "no longer exists on PyPI" HOT 2
- Add SOCKS support to proxy configuration parameter
- ImportError on S3DirEntry from 'mirror' operation HOT 2
- Enhance `bandersnatch mirror` to optionally delete packages detected as no longer found HOT 2
- Problems creating symlinks on Windows 10 HOT 4
- why are we replace the "." into "-",and how can i change it ? HOT 2
- configparser.NoOptionError: No option 'storage-backend' in section: 'mirror' HOT 2
- Help port bandersnatch to latest S3Path APIs + python 3.12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bandersnatch.