mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-31 13:34:12 +00:00 
			
		
		
		
	fix(backend): nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正 (#13712)
* Fix files * CHANGELOG
This commit is contained in:
		
							parent
							
								
									b4faa7c4ec
								
							
						
					
					
						commit
						c687b4eaa5
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		|  | @ -52,6 +52,7 @@ | ||||||
| - Fix: リプライのみの引用リノートと、CWのみの引用リノートが純粋なリノートとして誤って扱われてしまう問題を修正 | - Fix: リプライのみの引用リノートと、CWのみの引用リノートが純粋なリノートとして誤って扱われてしまう問題を修正 | ||||||
| - Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように   | - Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように   | ||||||
|   (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606) |   (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606) | ||||||
|  | - Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正 | ||||||
| 
 | 
 | ||||||
| ## 2024.3.1 | ## 2024.3.1 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -214,6 +214,8 @@ export class FileServerService { | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream'); | 				reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream'); | ||||||
|  | 				reply.header('Content-Length', file.file.size); | ||||||
|  | 				reply.header('Cache-Control', 'max-age=31536000, immutable'); | ||||||
| 				reply.header('Content-Disposition', | 				reply.header('Content-Disposition', | ||||||
| 					contentDisposition( | 					contentDisposition( | ||||||
| 						'inline', | 						'inline', | ||||||
|  | @ -256,6 +258,7 @@ export class FileServerService { | ||||||
| 				return fs.createReadStream(file.path); | 				return fs.createReadStream(file.path); | ||||||
| 			} else { | 			} else { | ||||||
| 				reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream'); | 				reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream'); | ||||||
|  | 				reply.header('Content-Length', file.file.size); | ||||||
| 				reply.header('Cache-Control', 'max-age=31536000, immutable'); | 				reply.header('Cache-Control', 'max-age=31536000, immutable'); | ||||||
| 				reply.header('Content-Disposition', contentDisposition('inline', file.filename)); | 				reply.header('Content-Disposition', contentDisposition('inline', file.filename)); | ||||||
| 
 | 
 | ||||||
|  | @ -530,9 +533,7 @@ export class FileServerService { | ||||||
| 		if (!file.storedInternal) { | 		if (!file.storedInternal) { | ||||||
| 			if (!(file.isLink && file.uri)) return '204'; | 			if (!(file.isLink && file.uri)) return '204'; | ||||||
| 			const result = await this.downloadAndDetectTypeFromUrl(file.uri); | 			const result = await this.downloadAndDetectTypeFromUrl(file.uri); | ||||||
| 			if (!file.size) { | 			file.size = (await fs.promises.stat(result.path)).size;	// DB file.sizeは正確とは限らないので
 | ||||||
| 				file.size = (await fs.promises.stat(result.path)).size; |  | ||||||
| 			} |  | ||||||
| 			return { | 			return { | ||||||
| 				...result, | 				...result, | ||||||
| 				url: file.uri, | 				url: file.uri, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue