File tree Expand file tree Collapse file tree 1 file changed +1
-26
lines changed Expand file tree Collapse file tree 1 file changed +1
-26
lines changed Original file line number Diff line number Diff line change @@ -10,25 +10,6 @@ import { Micro } from 'effect';
1010import { EditProposal } from '~/proto.js' ;
1111import type { Op } from './types.js' ;
1212
13- class CidValidateError extends Error {
14- readonly _tag = 'CidValidateError' ;
15- }
16-
17- function validateCid ( cid : string ) {
18- return Micro . gen ( function * ( ) {
19- const [ , cidContains ] = cid . split ( 'ipfs://' ) ;
20- if ( ! cid . startsWith ( 'ipfs://' ) ) {
21- yield * Micro . fail ( new CidValidateError ( `CID ${ cid } does not start with ipfs://` ) ) ;
22- }
23-
24- if ( cidContains === undefined || cidContains === '' ) {
25- yield * Micro . fail ( new CidValidateError ( `CID ${ cid } is not valid` ) ) ;
26- }
27-
28- return true ;
29- } ) ;
30- }
31-
3213class IpfsUploadError extends Error {
3314 readonly _tag = 'IpfsUploadError' ;
3415}
@@ -88,14 +69,8 @@ export async function publishEdit(args: PublishEditProposalArgs): Promise<string
8869 catch : error => new IpfsUploadError ( `Could not parse response from IPFS: ${ error } ` ) ,
8970 } ) ;
9071
91- yield * validateCid ( maybeCid ) ;
92-
9372 return maybeCid as `ipfs://${string } `;
9473 } ) ;
9574
96- return await Micro . runPromise (
97- Micro . retry ( upload , {
98- times : 3 ,
99- } ) ,
100- ) ;
75+ return await Micro . runPromise ( upload ) ;
10176}
You can’t perform that action at this time.
0 commit comments