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

query parameter has base64string #167

Open
TimberTang opened this issue Jul 30, 2020 · 1 comment
Open

query parameter has base64string #167

TimberTang opened this issue Jul 30, 2020 · 1 comment

Comments

@TimberTang
Copy link

like this
schema://entry?q=eyJ0eXBlIjoiTUVTU0FHRV9ERVRBSUwiLCJpZCI6Ik00YzNmNmE5Yzc4MjA0ZTE3OTQyZDBiMjdiNjFlZmEyMyIsInN0YXR1cyI6IkVOQUJMRUQiLCJxdWVyeSI6eyJib2R5IjoiQSBnZW50bGUgcmVtaW5kZXIgdGhhdCBTR0QgMTAuMDAgd2lsbCBiZSBkZWR1Y3RlZCBmb3IgdGhlIDJuZCBQYXltZW50IGZvciB5b3VyIG9yZGVyIE8wNTg1OTY5OTg4IG9uIDAxLUF1Zy0yMDIwLiIsImNyZWF0ZVRpbWUiOjE1OTU5OTUyMDAyMDAsImlzUmVhZCI6dHJ1ZSwibWVzc2FnZUlkIjoiTTRjM2Y2YTljNzgyMDRlMTc5NDJkMGIyN2I2MWVmYTIzIiwidGl0bGUiOiJQYXltZW50IFJlbWluZGVyIiwidXNlcklkIjoiVTVEQ0NDNzNDQ0M0ODc2MDAwMTA0MTRGQSJ9fQ==

@TimberTang
Copy link
Author

this is the code for parameterFromQuery

  • (NSDictionary *)DPL_parametersFromQueryString {
    NSArray *params = [self componentsSeparatedByString:@"&"];
    NSMutableDictionary *paramsDict = [NSMutableDictionary dictionaryWithCapacity:[params count]];
    for (NSString *param in params) {
    NSArray *pairs = [param componentsSeparatedByString:@"="];
    if (pairs.count == 2) {
    // e.g. ?key=value
    NSString *key = [pairs[0] DPL_stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *value = [pairs[1] DPL_stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    paramsDict[key] = value;
    }
    else if (pairs.count == 1) {
    // e.g. ?key
    NSString *key = [[pairs firstObject] DPL_stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    paramsDict[key] = @"";
    }
    }
    return [paramsDict copy];
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant