🐛 fix path
This commit is contained in:
		
							parent
							
								
									ede8ed4b71
								
							
						
					
					
						commit
						3bc8a96afd
					
				| @ -20,10 +20,25 @@ export class CDNServer extends Server { | ||||
| 		console.log("[Database] connected"); | ||||
| 
 | ||||
| 		await this.registerRoutes(path.join(__dirname, "routes/")); | ||||
| 
 | ||||
| 		this.app.use("/icons/", avatarsRoute); | ||||
| 		this.log("info", "[Server] Route /icons registered"); | ||||
| 
 | ||||
| 		this.app.use("/emojis/", avatarsRoute); | ||||
| 		this.log("info", "[Server] Route /emojis registered"); | ||||
| 
 | ||||
| 		this.app.use("/banners/", avatarsRoute); | ||||
| 		this.log("info", "[Server] Route /banners registered"); | ||||
| 
 | ||||
| 		this.app.use("/banners/", avatarsRoute); | ||||
| 		this.log("info", "[Server] Route /banners registered"); | ||||
| 
 | ||||
| 		this.app.use("/discover-splashes/", avatarsRoute); | ||||
| 		this.log("info", "[Server] Route /discover-splashes registered"); | ||||
| 
 | ||||
| 		this.app.use("/team-icons/", avatarsRoute); | ||||
| 		this.log("info", "[Server] Route /team-icons registered"); | ||||
| 
 | ||||
| 		return super.start(); | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -4,8 +4,9 @@ import { join, relative } from "path"; | ||||
| import "missing-native-js-functions"; | ||||
| 
 | ||||
| function getPath(path: string) { | ||||
| 	if (path.indexOf("\0") !== -1 || !/^[a-z0-9]+$/.test(path)) throw new Error("invalid path"); | ||||
| 	// STORAGE_LOCATION has a default value in start.ts
 | ||||
| 	return join(process.env.STORAGE_LOCATION || "../", relative("/", path)); | ||||
| 	return join(process.env.STORAGE_LOCATION || "../", path); | ||||
| } | ||||
| 
 | ||||
| export class FileStorage implements Storage { | ||||
| @ -22,7 +23,6 @@ export class FileStorage implements Storage { | ||||
| 	} | ||||
| 
 | ||||
| 	async delete(path: string) { | ||||
| 		path = join(process.env.STORAGE_LOCATION || "", path); | ||||
| 		fs.unlinkSync(path); | ||||
| 		fs.unlinkSync(getPath(path)); | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Flam3rboy
						Flam3rboy