Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
API
Commits
8604e22f
Commit
8604e22f
authored
Aug 17, 2023
by
q3k
Browse files
Options
Downloads
Patches
Plain Diff
apps: fix generated tarballs
parent
78eee03a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
server_apps.go
+29
-16
29 additions, 16 deletions
server_apps.go
with
29 additions
and
16 deletions
server_apps.go
+
29
−
16
View file @
8604e22f
...
...
@@ -165,22 +165,35 @@ func (s *server) targzApp(ctx context.Context, name, pathInRepo, repo string, ob
prefix
=
strings
.
ReplaceAll
(
repo
,
"/"
,
"-"
)
outPath
:=
path
.
Join
(
prefix
,
p
)
dirs
,
_
:=
path
.
Split
(
outPath
)
if
dirs
!=
""
{
parts
:=
strings
.
Split
(
dirs
,
"/"
)
cur
:=
parts
[
0
]
for
i
:=
1
;
i
<
len
(
parts
);
i
++
{
cur
+=
parts
[
i
]
if
!
directories
[
cur
]
{
directories
[
cur
]
=
true
ensureDir
:=
func
(
p
string
)
error
{
if
directories
[
p
]
{
return
nil
}
directories
[
p
]
=
true
err
=
t
.
WriteHeader
(
&
tar
.
Header
{
Name
:
cur
+
"/"
,
Name
:
p
,
Typeflag
:
tar
.
TypeDir
,
Mode
:
0755
,
})
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"CreateDir(%q): %w"
,
cur
,
err
)
return
fmt
.
Errorf
(
"CreateDir(%q): %w"
,
p
,
err
)
}
return
nil
}
dirs
,
_
:=
path
.
Split
(
outPath
)
if
dirs
!=
""
{
dirs
=
strings
.
TrimRight
(
dirs
,
"/"
)
parts
:=
strings
.
Split
(
dirs
,
"/"
)
cur
:=
parts
[
0
]
+
"/"
if
err
:=
ensureDir
(
cur
);
err
!=
nil
{
return
nil
,
err
}
for
i
:=
1
;
i
<
len
(
parts
);
i
++
{
cur
+=
parts
[
i
]
+
"/"
if
err
:=
ensureDir
(
cur
);
err
!=
nil
{
return
nil
,
err
}
}
}
...
...
@@ -365,7 +378,7 @@ func (s *server) getAppInfo(ctx context.Context, pathInRepo, repo string) (*appI
// app. This is based on md5 so ambitious hack3rs can force a certain
// app seed :)
flow3rSeedMd5
:=
md5
.
Sum
([]
byte
(
repo
))
app
.
flow3rSeed
=
""
;
app
.
flow3rSeed
=
""
for
i
:=
0
;
i
<
8
;
i
++
{
app
.
flow3rSeed
+=
string
(
flow3rSeedMd5
[
i
]
%
5
+
byte
(
'0'
))
}
...
...
@@ -481,7 +494,7 @@ type jsonApp struct {
Flow3rSeed
string
`json:"flow3rSeed"`
}
func
makeJsonApp
(
a
*
appDescriptor
)
(
jsonApp
)
{
func
makeJsonApp
(
a
*
appDescriptor
)
jsonApp
{
return
jsonApp
{
RepoURL
:
"https://git.flow3r.garden/"
+
a
.
repository
,
Commit
:
a
.
appInfo
.
commit
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment