File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3535 ca-certificates \
3636 && rm -rf /var/lib/apt/lists/*
3737
38- # Download the latest yt-dlp release directly from GitHub
39- RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
40- chmod +x /usr/local/bin/yt-dlp
38+ # Download the latest yt-dlp release to a dedicated writable directory
39+ # so non-root users (YOUTARR_UID/YOUTARR_GID) can self-update at runtime
40+ RUN mkdir -p /opt/yt-dlp && \
41+ curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /opt/yt-dlp/yt-dlp && \
42+ chmod 0777 /opt/yt-dlp /opt/yt-dlp/yt-dlp
43+ ENV PATH="/opt/yt-dlp:${PATH}"
4144
4245# Install Deno
4346ENV DENO_INSTALL="/usr/local"
Original file line number Diff line number Diff line change @@ -307,6 +307,20 @@ describe('ytdlpModule', () => {
307307 expect ( result . message ) . toContain ( 'Permission denied' ) ;
308308 } ) ;
309309
310+ it ( 'handles "Unable to write to" permission error' , async ( ) => {
311+ const mockProcess = createMockProcess ( ) ;
312+ spawn . mockReturnValue ( mockProcess ) ;
313+
314+ const updatePromise = ytdlpModule . performUpdate ( ) ;
315+
316+ mockProcess . stderr . emit ( 'data' , 'Unable to write to /usr/local/bin/yt-dlp; try running as administrator' ) ;
317+ mockProcess . emit ( 'close' , 100 ) ;
318+
319+ const result = await updatePromise ;
320+ expect ( result . success ) . toBe ( false ) ;
321+ expect ( result . message ) . toContain ( 'Permission denied' ) ;
322+ } ) ;
323+
310324 it ( 'handles non-zero exit code' , async ( ) => {
311325 const mockProcess = createMockProcess ( ) ;
312326 spawn . mockReturnValue ( mockProcess ) ;
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ function performUpdate() {
196196 const output = stdout + stderr ;
197197
198198 if ( code !== 0 ) {
199- if ( output . includes ( 'Permission denied' ) ) {
199+ if ( output . includes ( 'Permission denied' ) || output . includes ( 'Unable to write to' ) ) {
200200 logger . warn ( { output } , 'yt-dlp update failed: permission denied' ) ;
201201 resolve ( {
202202 success : false ,
You can’t perform that action at this time.
0 commit comments