Skip to content

Commit

Permalink
Merge pull request #430 from berty/dev/moul/dmg
Browse files Browse the repository at this point in the history
  • Loading branch information
moul authored Feb 4, 2022
2 parents 0e47e35 + 7a73e5f commit 0cfd767
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions go/pkg/yolosvc/api_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ func (svc *service) ArtifactDownloader(w http.ResponseWriter, r *http.Request) {
if err != nil {
httpError(w, err, codes.Internal)
}
case ".unsigned-dmg", ".dummy-signed-dmg":
// TODO: implement à-la-zsign (re)signature
// TODO: patch the .dmg to append some additional context
var (
cacheKey = artifact.ID
filename = strings.TrimSuffix(path.Base(artifact.LocalPath), ext) + ".dmg"
mimetype = artifact.MimeType
filesize = artifact.FileSize
)
err := svc.sendFileMayCache(filename, cacheKey, mimetype, filesize, w, func(w io.Writer) error {
return svc.artifactDownloadFromProvider(artifact, w)
})
if err != nil {
httpError(w, err, codes.Internal)
}
default:
var (
cacheKey = artifact.ID
Expand Down
4 changes: 2 additions & 2 deletions go/pkg/yolosvc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func artifactKindByPath(path string) yolopb.Artifact_Kind {
switch filepath.Ext(path) {
case ".ipa", ".unsigned-ipa", ".dummy-signed-ipa":
return yolopb.Artifact_IPA
case ".dmg":
case ".dmg", ".unsigned-dmg" , ".dummy-signed-dmg":
return yolopb.Artifact_DMG
case ".apk":
return yolopb.Artifact_APK
Expand All @@ -32,7 +32,7 @@ func mimetypeByPath(path string) string {
return "application/octet-stream"
case ".apk":
return "application/vnd.android.package-archive"
case ".dmg":
case ".dmg", ".unsigned-dmg", ".dummy-signed-dmg":
return "application/x-apple-diskimage"
case ".jar":
return "application/java-archive"
Expand Down

0 comments on commit 0cfd767

Please sign in to comment.