ファイルのURLを保存するように
This commit is contained in:
		
							parent
							
								
									e37c19fdcd
								
							
						
					
					
						commit
						414c600356
					
				
					 4 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
					@ -28,7 +28,8 @@ export type IMetadata = {
 | 
				
			||||||
	_user: any;
 | 
						_user: any;
 | 
				
			||||||
	folderId: mongo.ObjectID;
 | 
						folderId: mongo.ObjectID;
 | 
				
			||||||
	comment: string;
 | 
						comment: string;
 | 
				
			||||||
	uri: string;
 | 
						uri?: string;
 | 
				
			||||||
 | 
						url?: string;
 | 
				
			||||||
	deletedAt?: Date;
 | 
						deletedAt?: Date;
 | 
				
			||||||
	isExpired?: boolean;
 | 
						isExpired?: boolean;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,7 +24,7 @@ export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	log(`Creating the Image: ${image.url}`);
 | 
						log(`Creating the Image: ${image.url}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return await uploadFromUrl(image.url, actor);
 | 
						return await uploadFromUrl(image.url, actor, null, image.url);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,6 +62,7 @@ const addFile = async (
 | 
				
			||||||
	comment: string = null,
 | 
						comment: string = null,
 | 
				
			||||||
	folderId: mongodb.ObjectID = null,
 | 
						folderId: mongodb.ObjectID = null,
 | 
				
			||||||
	force: boolean = false,
 | 
						force: boolean = false,
 | 
				
			||||||
 | 
						url: string = null,
 | 
				
			||||||
	uri: string = null
 | 
						uri: string = null
 | 
				
			||||||
): Promise<IDriveFile> => {
 | 
					): Promise<IDriveFile> => {
 | 
				
			||||||
	log(`registering ${name} (user: ${getAcct(user)}, path: ${path})`);
 | 
						log(`registering ${name} (user: ${getAcct(user)}, path: ${path})`);
 | 
				
			||||||
| 
						 | 
					@ -296,6 +297,10 @@ const addFile = async (
 | 
				
			||||||
		properties: properties
 | 
							properties: properties
 | 
				
			||||||
	} as IMetadata;
 | 
						} as IMetadata;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (url !== null) {
 | 
				
			||||||
 | 
							metadata.url = url;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (uri !== null) {
 | 
						if (uri !== null) {
 | 
				
			||||||
		metadata.uri = uri;
 | 
							metadata.uri = uri;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ export default async (url, user, folderId = null, uri = null): Promise<IDriveFil
 | 
				
			||||||
	let error;
 | 
						let error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		driveFile = await create(user, path, name, null, folderId, false, uri);
 | 
							driveFile = await create(user, path, name, null, folderId, false, url, uri);
 | 
				
			||||||
		log(`created: ${driveFile._id}`);
 | 
							log(`created: ${driveFile._id}`);
 | 
				
			||||||
	} catch (e) {
 | 
						} catch (e) {
 | 
				
			||||||
		error = e;
 | 
							error = e;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue