@@ -47,8 +47,8 @@ protected function configure(): void {
4747 $ this
4848 ->setName ('files:put ' )
4949 ->setDescription ('Write contents of a file ' )
50- ->addArgument ('input ' , InputArgument::REQUIRED , "Source file to write , use - to read from STDIN " )
51- ->addArgument ('file ' , InputArgument::REQUIRED , "File path to write to or fileid of existing file " );
50+ ->addArgument ('input ' , InputArgument::REQUIRED , "Source local path , use - to read from STDIN " )
51+ ->addArgument ('file ' , InputArgument::REQUIRED , "Target Nextcloud file path to write to or fileid of existing file " );
5252 }
5353
5454 public function execute (InputInterface $ input , OutputInterface $ output ): int {
@@ -65,13 +65,17 @@ public function execute(InputInterface $input, OutputInterface $output): int {
6565 return 1 ;
6666 }
6767
68- $ source = (! $ inputName || $ inputName === '- ' ) ? STDIN : fopen ($ inputName , 'r ' );
68+ $ source = ($ inputName === null || $ inputName === '- ' ) ? STDIN : fopen ($ inputName , 'r ' );
6969 if (!$ source ) {
7070 $ output ->writeln ("<error>Failed to open $ inputName</error> " );
7171 return 1 ;
7272 }
7373 if ($ node instanceof File) {
7474 $ target = $ node ->fopen ('w ' );
75+ if (!$ target ) {
76+ $ output ->writeln ("<error>Failed to open $ fileOutput</error> " );
77+ return 1 ;
78+ }
7579 stream_copy_to_stream ($ source , $ target );
7680 } else {
7781 $ this ->rootFolder ->newFile ($ fileOutput , $ source );
0 commit comments