Fossil SCM
When generating ZIP archives, files with zero bytes are 'Stored', not 'Deflated'.
Commit
ecedaf93991c66a4a9d311f0f97a62253f51a7be
Parent
3d5cf48bf2828ec…
1 file changed
+1
-1
+1
-1
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -143,11 +143,11 @@ | ||
| 143 | 143 | |
| 144 | 144 | /* Fill in as much of the header as we know. |
| 145 | 145 | */ |
| 146 | 146 | nBlob = pFile ? blob_size(pFile) : 0; |
| 147 | 147 | if( pFile ){ /* This is a file, possibly empty... */ |
| 148 | - iMethod = 8; | |
| 148 | + iMethod = (nBlob>0) ? 8 : 0; /* Cannot compress zero bytes. */ | |
| 149 | 149 | switch( mPerm ){ |
| 150 | 150 | case PERM_LNK: iMode = 0120755; break; |
| 151 | 151 | case PERM_EXE: iMode = 0100755; break; |
| 152 | 152 | default: iMode = 0100644; break; |
| 153 | 153 | } |
| 154 | 154 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -143,11 +143,11 @@ | |
| 143 | |
| 144 | /* Fill in as much of the header as we know. |
| 145 | */ |
| 146 | nBlob = pFile ? blob_size(pFile) : 0; |
| 147 | if( pFile ){ /* This is a file, possibly empty... */ |
| 148 | iMethod = 8; |
| 149 | switch( mPerm ){ |
| 150 | case PERM_LNK: iMode = 0120755; break; |
| 151 | case PERM_EXE: iMode = 0100755; break; |
| 152 | default: iMode = 0100644; break; |
| 153 | } |
| 154 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -143,11 +143,11 @@ | |
| 143 | |
| 144 | /* Fill in as much of the header as we know. |
| 145 | */ |
| 146 | nBlob = pFile ? blob_size(pFile) : 0; |
| 147 | if( pFile ){ /* This is a file, possibly empty... */ |
| 148 | iMethod = (nBlob>0) ? 8 : 0; /* Cannot compress zero bytes. */ |
| 149 | switch( mPerm ){ |
| 150 | case PERM_LNK: iMode = 0120755; break; |
| 151 | case PERM_EXE: iMode = 0100755; break; |
| 152 | default: iMode = 0100644; break; |
| 153 | } |
| 154 |