mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	fix: AssetInterceptor "can't set headers after they are sent" (#9987)
* fix: AssetInterceptor "can't set headers after they are sent" * chore: remove long comment --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
		
							parent
							
								
									cf223dc98c
								
							
						
					
					
						commit
						ce985ef8f8
					
				@ -1,6 +1,7 @@
 | 
			
		||||
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
 | 
			
		||||
import { Response } from 'express';
 | 
			
		||||
import { AssetMediaResponseDto } from 'src/dtos/asset-media-response.dto';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { AssetMediaResponseDto, AssetMediaStatus } from 'src/dtos/asset-media-response.dto';
 | 
			
		||||
import { ImmichHeader } from 'src/dtos/auth.dto';
 | 
			
		||||
import { AuthenticatedRequest } from 'src/middleware/auth.guard';
 | 
			
		||||
import { AssetMediaService } from 'src/services/asset-media.service';
 | 
			
		||||
@ -17,7 +18,8 @@ export class AssetUploadInterceptor implements NestInterceptor {
 | 
			
		||||
    const checksum = fromMaybeArray(req.headers[ImmichHeader.CHECKSUM]);
 | 
			
		||||
    const response = await this.service.getUploadAssetIdByChecksum(req.user, checksum);
 | 
			
		||||
    if (response) {
 | 
			
		||||
      res.status(200).send(response);
 | 
			
		||||
      res.status(200);
 | 
			
		||||
      return of({ status: AssetMediaStatus.DUPLICATE, id: response.id });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return next.handle();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user