Skip to content

Commit 9f625a4

Browse files
committed
refactor: remove check if filepath on dutctl matches with args
Signed-off-by: Fabian Wienand <fabian.wienand@9elements.com>
1 parent ded8a2c commit 9f625a4

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

cmds/dutctl/rpc.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ func (app *application) runRPC(device, command string, cmdArgs []string) error {
179179
path := msg.FileRequest.GetPath()
180180
log.Printf("File request for: %q\n", path)
181181

182-
if !isPartOfArgs(cmdArgs, path) {
183-
errChan <- fmt.Errorf("invalid file request: requested file %q was not named in the command's arguments", path)
184-
185-
return
186-
}
187-
188182
content, err := os.ReadFile(path)
189183
if err != nil {
190184
errChan <- fmt.Errorf("reading requested file %q: %w", path, err)
@@ -213,12 +207,6 @@ func (app *application) runRPC(device, command string, cmdArgs []string) error {
213207

214208
log.Printf("Received file: %q\n", path)
215209

216-
if !isPartOfArgs(cmdArgs, path) {
217-
errChan <- fmt.Errorf("invalid file transmission: received file %q was not named in the command's arguments", path)
218-
219-
return
220-
}
221-
222210
if len(content) == 0 {
223211
log.Println("Received empty file content")
224212
}
@@ -287,13 +275,3 @@ func (app *application) runRPC(device, command string, cmdArgs []string) error {
287275
return err
288276
}
289277
}
290-
291-
func isPartOfArgs(args []string, token string) bool {
292-
for _, arg := range args {
293-
if strings.Contains(arg, token) {
294-
return true
295-
}
296-
}
297-
298-
return false
299-
}

0 commit comments

Comments
 (0)