ファイル作成APIにforceオプションを実装
This commit is contained in:
		
							parent
							
								
									1729d05e8c
								
							
						
					
					
						commit
						c4e8cabae9
					
				
					 1 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -31,19 +31,23 @@ export const meta = {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}),
 | 
							}),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		isSensitive: $.bool.optional.nullable.note({
 | 
							isSensitive: $.bool.optional.note({
 | 
				
			||||||
			default: null,
 | 
								default: false,
 | 
				
			||||||
			desc: {
 | 
								desc: {
 | 
				
			||||||
				'ja-JP': 'このメディアが「閲覧注意」(NSFW)かどうか',
 | 
									'ja-JP': 'このメディアが「閲覧注意」(NSFW)かどうか',
 | 
				
			||||||
				'en-US': 'Whether this media is NSFW'
 | 
									'en-US': 'Whether this media is NSFW'
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							force: $.bool.optional.note({
 | 
				
			||||||
 | 
								default: false,
 | 
				
			||||||
 | 
								desc: {
 | 
				
			||||||
 | 
									'ja-JP': 'true にすると、同じハッシュを持つファイルが既にアップロードされていても強制的にファイルを作成します。',
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Create a file
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export default async (file: any, params: any, user: ILocalUser): Promise<any> => {
 | 
					export default async (file: any, params: any, user: ILocalUser): Promise<any> => {
 | 
				
			||||||
	if (file == null) {
 | 
						if (file == null) {
 | 
				
			||||||
		throw 'file is required';
 | 
							throw 'file is required';
 | 
				
			||||||
| 
						 | 
					@ -76,7 +80,7 @@ export default async (file: any, params: any, user: ILocalUser): Promise<any> =>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		// Create file
 | 
							// Create file
 | 
				
			||||||
		const driveFile = await create(user, file.path, name, null, ps.folderId, false, false, null, null, ps.isSensitive);
 | 
							const driveFile = await create(user, file.path, name, null, ps.folderId, ps.force, false, null, null, ps.isSensitive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		cleanup();
 | 
							cleanup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue