Skip to content

Commit d7b0755

Browse files
committed
check for abs path
1 parent fabf284 commit d7b0755

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

frontend/types/gotypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ declare global {
6060
shellprocstatus?: string;
6161
shellprocconnname?: string;
6262
shellprocexitcode: number;
63+
tsunamiport?: number;
6364
};
6465

6566
// waveobj.BlockDef

pkg/blockcontroller/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.old

pkg/blockcontroller/tsunamicontroller.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,37 @@ func (c *TsunamiController) Start(ctx context.Context, blockMeta waveobj.MetaMap
134134
if scaffoldPath == "" {
135135
return fmt.Errorf("tsunami:scaffoldpath is required")
136136
}
137+
scaffoldPath, err := wavebase.ExpandHomeDir(scaffoldPath)
138+
if err != nil {
139+
return fmt.Errorf("tsunami:scaffoldpath invalid: %w", err)
140+
}
141+
if !filepath.IsAbs(scaffoldPath) {
142+
return fmt.Errorf("tsunami:scaffoldpath must be absolute: %s", scaffoldPath)
143+
}
137144

138145
sdkReplacePath := blockMeta.GetString(waveobj.MetaKey_TsunamiSdkReplacePath, "")
139146
if sdkReplacePath == "" {
140147
return fmt.Errorf("tsunami:sdkreplacepath is required")
141148
}
149+
sdkReplacePath, err = wavebase.ExpandHomeDir(sdkReplacePath)
150+
if err != nil {
151+
return fmt.Errorf("tsunami:sdkreplacepath invalid: %w", err)
152+
}
153+
if !filepath.IsAbs(sdkReplacePath) {
154+
return fmt.Errorf("tsunami:sdkreplacepath must be absolute: %s", sdkReplacePath)
155+
}
142156

143157
appPath := blockMeta.GetString(waveobj.MetaKey_TsunamiAppPath, "")
144158
if appPath == "" {
145159
return fmt.Errorf("tsunami:apppath is required")
146160
}
161+
appPath, err = wavebase.ExpandHomeDir(appPath)
162+
if err != nil {
163+
return fmt.Errorf("tsunami:apppath invalid: %w", err)
164+
}
165+
if !filepath.IsAbs(appPath) {
166+
return fmt.Errorf("tsunami:apppath must be absolute: %s", appPath)
167+
}
147168

148169
appName := filepath.Base(appPath)
149170
osArch := runtime.GOOS + "-" + runtime.GOARCH

0 commit comments

Comments
 (0)