mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-30 15:07:04 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39c85f10c7 |
@@ -1,26 +0,0 @@
|
||||
name: Cleanup dangling container images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- bulk-cleanup-ghcr
|
||||
|
||||
# Run the two cleanup workflows one at a time.
|
||||
concurrency:
|
||||
group: ghcr-images
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
# Untagged architecture manifests can still belong to a tagged image.
|
||||
- name: Delete untagged and unreferenced versions
|
||||
uses: dataaxiom/ghcr-cleanup-action@v1.2.2
|
||||
with:
|
||||
package: xray-core
|
||||
delete-untagged: true
|
||||
dry-run: true
|
||||
@@ -1,30 +0,0 @@
|
||||
name: Cleanup sha- container images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- bulk-cleanup-ghcr
|
||||
|
||||
# Run the two cleanup workflows one at a time.
|
||||
concurrency:
|
||||
group: ghcr-images
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
# The repository needs Admin access under the package's Manage Actions access.
|
||||
- name: Delete versions with only sha- tags
|
||||
uses: dataaxiom/ghcr-cleanup-action@v1.2.2
|
||||
with:
|
||||
package: xray-core
|
||||
use-regex: true
|
||||
delete-tags: '^sha-'
|
||||
# Preserve every non-sha- tag. The colon check avoids matching digests.
|
||||
exclude-tags: '^(?!sha-)[^:]+$'
|
||||
delete-untagged: false
|
||||
dry-run: true
|
||||
+18
-1
@@ -1,6 +1,8 @@
|
||||
package geodata
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
go_errors "errors"
|
||||
@@ -197,7 +199,22 @@ func (d *downloader) fetch(rawURL string, writer io.Writer) error {
|
||||
return errors.New("geodata download exceeds 256 MiB")
|
||||
}
|
||||
|
||||
n, err := io.Copy(writer, io.LimitReader(resp.Body, maxDownloadSize+1))
|
||||
br := bufio.NewReader(resp.Body)
|
||||
header, err := br.Peek(2)
|
||||
if err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
var body io.Reader = br
|
||||
if len(header) == 2 && header[0] == 0x1f && header[1] == 0x8b {
|
||||
zr, err := gzip.NewReader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer zr.Close()
|
||||
body = zr
|
||||
}
|
||||
|
||||
n, err := io.Copy(writer, io.LimitReader(body, maxDownloadSize+1))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user