File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,17 @@ export class ActorsPullCommand extends ApifyCommand<typeof ActorsPullCommand> {
8585 throw new Error ( `Cannot find Actor with ID/name '${ actorId } ' in your account.` ) ;
8686 }
8787
88- if ( ! actor ) throw new Error ( `Cannot find Actor with ID/name '${ actorId } ' in your account.` ) ;
88+ if ( ! actor ) {
89+ throw new Error ( `Cannot find Actor with ID/name '${ actorId } ' in your account.` ) ;
90+ }
8991
9092 const { name, versions } = actor ;
9193
94+ // @ts -expect-error TODO: fix apify-client types
95+ if ( actor . isSourceCodeHidden && ! actor . versions . length ) {
96+ throw new Error ( `You cannot pull source code of this Actor because you do not have permission to do so.` ) ;
97+ }
98+
9299 let correctVersion = null ;
93100 if ( this . flags . version ) {
94101 correctVersion = versions . find ( ( version ) => version . versionNumber === this . flags . version ) ;
Original file line number Diff line number Diff line change @@ -217,4 +217,12 @@ describe('[api] apify pull', () => {
217217
218218 expect ( exists ) . to . be . eql ( true ) ;
219219 } ) ;
220+
221+ it ( 'should fail if actor is private' , async ( ) => {
222+ await testRunCommand ( ActorsPullCommand , { args_actorId : 'apify/website-content-crawler' } ) ;
223+
224+ expect ( lastErrorMessage ( ) ) . toMatch (
225+ / Y o u c a n n o t p u l l s o u r c e c o d e o f t h i s A c t o r b e c a u s e y o u d o n o t h a v e p e r m i s s i o n t o d o s o ./ i,
226+ ) ;
227+ } ) ;
220228} ) ;
You can’t perform that action at this time.
0 commit comments