2018-07-31 17:26:10 +00:00
|
|
|
#!/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"
|
|
|
|
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
git lfs track "*.tar.gz"
|
2018-07-31 17:26:10 +00:00
|
|
|
printf "aaaaaaaaaa" > a.txt
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
tar -czf a.tar.gz a.txt
|
2018-07-31 17:26:10 +00:00
|
|
|
rm a.txt
|
|
|
|
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
git add .gitattributes a.tar.gz
|
2018-07-31 17:26:10 +00:00
|
|
|
git commit -m "initial commit"
|
2020-06-29 16:18:57 +00:00
|
|
|
GIT_CURL_VERBOSE=1 git push origin main 2>&1 | tee push.log
|
2018-07-31 17:26:10 +00:00
|
|
|
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
[ 1 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
|
2018-08-28 14:44:42 +00:00
|
|
|
[ 0 -eq "$(grep -c "Content-Type: application/octet-stream" push.log)" ]
|
2018-07-31 17:26:10 +00:00
|
|
|
)
|
|
|
|
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"
|
|
|
|
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
git lfs track "*.tar.gz"
|
2018-07-31 17:26:10 +00:00
|
|
|
printf "aaaaaaaaaa" > a.txt
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
tar -czf a.tar.gz a.txt
|
2018-07-31 17:26:10 +00:00
|
|
|
rm a.txt
|
|
|
|
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
git add .gitattributes a.tar.gz
|
2018-07-31 17:26:10 +00:00
|
|
|
git commit -m "initial commit"
|
2018-08-01 00:47:10 +00:00
|
|
|
git config "lfs.$GITSERVER.contenttype" 0
|
2020-06-29 16:18:57 +00:00
|
|
|
GIT_CURL_VERBOSE=1 git push origin main 2>&1 | tee push.log
|
2018-07-31 17:26:10 +00:00
|
|
|
|
t: use 'tar' instead of 'zip'
In [1], we used 'zip(1)' to create *.zip files in these integration
tests because ZIP files begin with the header:
[]byte{0x50, 0x4B, 0x03, 0x04}
And thus are detected as 'application/zip' by http.DetectContentType().
However, this 'zip(1)' program does not exist on Windows, hence the
recent test failures (starting as early as [1]).
Instead, let's use 'tar -czf', which creates gzip-compressed tarballs,
and begin with the header:
[]byte{0x1F, 0x8B, 0x80}
Thus are detected as 'application/x-gzip' by http.DetectContentType().
This should allow this test to run on AppVeyor (and more generally, on
Windows as a whole) again.
[1]: 938df5c4 (tq/basic_upload.go: disable Content-Type detection by
configuration, 2018-07-31)
2018-08-01 16:05:58 +00:00
|
|
|
[ 0 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
|
2018-08-28 14:44:42 +00:00
|
|
|
[ 1 -eq "$(grep -c "Content-Type: application/octet-stream" push.log)" ]
|
2018-07-31 17:26:10 +00:00
|
|
|
)
|
|
|
|
end_test
|
2018-07-31 18:24:17 +00:00
|
|
|
|
|
|
|
begin_test "content-type: warning message"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
|
|
|
|
reponame="content-type-warning-message"
|
|
|
|
setup_remote_repo "$reponame"
|
|
|
|
clone_repo "$reponame" "$reponame"
|
|
|
|
|
|
|
|
git lfs track "*.txt"
|
|
|
|
printf "status-storage-422" > a.txt
|
|
|
|
|
|
|
|
git add .gitattributes a.txt
|
|
|
|
git commit -m "initial commit"
|
2020-06-29 16:18:57 +00:00
|
|
|
git push origin main 2>&1 | tee push.log
|
2018-07-31 18:24:17 +00:00
|
|
|
|
|
|
|
grep "info: Uploading failed due to unsupported Content-Type header(s)." push.log
|
|
|
|
grep "info: Consider disabling Content-Type detection with:" push.log
|
|
|
|
grep "info: $ git config lfs.contenttype false" push.log
|
|
|
|
)
|
|
|
|
end_test
|