938df5c47f
For the majority of Git LFS's lifetime, Git LFS objects have been uploaded via HTTP and contained the header: Content-Type: application/octet-stream In [1], this changed and we began attempting to guess an appropriate Content-Type header based on the first 512 bytes of the file being uploaded. This breaks some hosting platforms' implementation of this API, so let's offer a way to disable this guessing to allow users to upload objects again on affected implementations. [1]: a1736293 (Merge pull request #3137 from calavera/set_upload_content_type, 2018-07-23)
47 lines
1.0 KiB
Bash
Executable File
47 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
. "$(dirname "$0")/testlib.sh"
|
|
|
|
begin_test "content-type: is enabled by default"
|
|
(
|
|
set -e
|
|
|
|
reponame="content-type-enabled-default"
|
|
setup_remote_repo "$reponame"
|
|
clone_repo "$reponame" "$reponame"
|
|
|
|
git lfs track "*.zip"
|
|
printf "aaaaaaaaaa" > a.txt
|
|
zip -j a.zip a.txt
|
|
rm a.txt
|
|
|
|
git add .gitattributes a.zip
|
|
git commit -m "initial commit"
|
|
GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
|
|
|
|
[ 1 -eq "$(grep -c "Content-Type: application/zip" push.log)" ]
|
|
)
|
|
end_test
|
|
|
|
begin_test "content-type: is disabled by configuration"
|
|
(
|
|
set -e
|
|
|
|
reponame="content-type-disabled-by-configuration"
|
|
setup_remote_repo "$reponame"
|
|
clone_repo "$reponame" "$reponame"
|
|
|
|
git lfs track "*.zip"
|
|
printf "aaaaaaaaaa" > a.txt
|
|
zip -j a.zip a.txt
|
|
rm a.txt
|
|
|
|
git add .gitattributes a.zip
|
|
git commit -m "initial commit"
|
|
git config "lfs.$GITSERVER/$reponame.git.contenttype" 0
|
|
GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
|
|
|
|
[ 1 -eq "$(grep -c "Content-Type: application/zip" push.log)" ]
|
|
)
|
|
end_test
|