@@ -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