mirror of
				https://github.com/Crazyco-xyz/48hr.email.git
				synced 2025-11-04 07:16:32 +01:00 
			
		
		
		
	if attachment try if attachment - why?
This commit is contained in:
		
							parent
							
								
									5469aacc72
								
							
						
					
					
						commit
						5a1d7c038d
					
				
					 1 changed files with 4 additions and 17 deletions
				
			
		| 
						 | 
					@ -109,23 +109,10 @@ router.get(
 | 
				
			||||||
			const attachment = mail.attachments[index];
 | 
								const attachment = mail.attachments[index];
 | 
				
			||||||
			if (attachment) {
 | 
								if (attachment) {
 | 
				
			||||||
				try {
 | 
									try {
 | 
				
			||||||
					if (attachment) {
 | 
										res.set('Content-Disposition', `attachment; filename=${attachment.filename}`);
 | 
				
			||||||
						res.set('Content-Disposition', `attachment; filename=${attachment.filename}`);
 | 
										res.set('Content-Type', attachment.contentType);
 | 
				
			||||||
						res.set('Content-Type', attachment.contentType);
 | 
										res.send(attachment.content);
 | 
				
			||||||
						res.send(attachment.content);
 | 
										return;
 | 
				
			||||||
						return;
 | 
					 | 
				
			||||||
					} else {
 | 
					 | 
				
			||||||
						res.render(
 | 
					 | 
				
			||||||
							'error',
 | 
					 | 
				
			||||||
							{
 | 
					 | 
				
			||||||
								address: req.params.address,
 | 
					 | 
				
			||||||
								message: 'This attachment could not be found. It either does not exist or has been deleted from our servers!',
 | 
					 | 
				
			||||||
								madeby: config.http.branding[1],
 | 
					 | 
				
			||||||
								madebysite: config.http.branding[2],
 | 
					 | 
				
			||||||
							}
 | 
					 | 
				
			||||||
						);
 | 
					 | 
				
			||||||
						return;
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				} catch (error) {
 | 
									} catch (error) {
 | 
				
			||||||
					console.error('error while fetching attachment', error);
 | 
										console.error('error while fetching attachment', error);
 | 
				
			||||||
					next(error);
 | 
										next(error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue