Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- [LKImageLocalFileLoader dataWithRequest:callback:] fileURL 生成应该使用 - [NSURL fileURLWithPath:] 而不是 - [NSURL URLWithString:],如果 request.URL 中可能包含 fileURL:// 前缀,则此处存在歧义,是否应该替换其他属性或者进行重命名? #40

Open
PipeDog opened this issue Apr 22, 2021 · 0 comments

Comments

@PipeDog
Copy link

PipeDog commented Apr 22, 2021

  • (void)dataWithRequest:(LKImageRequest *)request callback:(LKImageDataCallback)callback
    {
    if (![request isKindOfClass:[LKImageURLRequest class]])
    {
    NSError *error = [LKImageError errorWithCode:LKImageErrorCodeInvalidLoader];
    callback(request, nil, 0, error);
    return;
    }
    NSString *URL = ((LKImageURLRequest *) request).URL;
    NSURL *fileURL = [NSURL URLWithString:URL];
    NSData *data = [NSData dataWithContentsOfURL:fileURL];
    if (data)
    {
    callback(request, data, 1, nil);
    }
    else
    {
    NSError *error = [LKImageError errorWithCode:LKImageErrorCodeFileNotFound];
    callback(request, nil, 0, error);
    }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant