mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-30 21:14: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: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように   | ||||
|   (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606) | ||||
| - Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正 | ||||
| 
 | ||||
| ## 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-Length', file.file.size); | ||||
| 				reply.header('Cache-Control', 'max-age=31536000, immutable'); | ||||
| 				reply.header('Content-Disposition', | ||||
| 					contentDisposition( | ||||
| 						'inline', | ||||
|  | @ -256,6 +258,7 @@ export class FileServerService { | |||
| 				return fs.createReadStream(file.path); | ||||
| 			} else { | ||||
| 				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('Content-Disposition', contentDisposition('inline', file.filename)); | ||||
| 
 | ||||
|  | @ -530,9 +533,7 @@ export class FileServerService { | |||
| 		if (!file.storedInternal) { | ||||
| 			if (!(file.isLink && file.uri)) return '204'; | ||||
| 			const result = await this.downloadAndDetectTypeFromUrl(file.uri); | ||||
| 			if (!file.size) { | ||||
| 				file.size = (await fs.promises.stat(result.path)).size; | ||||
| 			} | ||||
| 			file.size = (await fs.promises.stat(result.path)).size;	// DB file.sizeは正確とは限らないので
 | ||||
| 			return { | ||||
| 				...result, | ||||
| 				url: file.uri, | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue