{"action":"created","issue":{"url":"https://api.github.com/repos/wonday/react-native-pdf/issues/230","repository_url":"https://api.github.com/repos/wonday/react-native-pdf","labels_url":"https://api.github.com/repos/wonday/react-native-pdf/issues/230/labels{/name}","comments_url":"https://api.github.com/repos/wonday/react-native-pdf/issues/230/comments","events_url":"https://api.github.com/repos/wonday/react-native-pdf/issues/230/events","html_url":"https://github.com/wonday/react-native-pdf/issues/230","id":356453158,"node_id":"MDU6SXNzdWUzNTY0NTMxNTg=","number":230,"title":"Getting 'url not defined' ERROR on iOS","user":{"login":"mdmush","id":6891822,"node_id":"MDQ6VXNlcjY4OTE4MjI=","avatar_url":"https://avatars1.githubusercontent.com/u/6891822?v=4","gravatar_id":"","url":"https://api.github.com/users/mdmush","html_url":"https://github.com/mdmush","followers_url":"https://api.github.com/users/mdmush/followers","following_url":"https://api.github.com/users/mdmush/following{/other_user}","gists_url":"https://api.github.com/users/mdmush/gists{/gist_id}","starred_url":"https://api.github.com/users/mdmush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdmush/subscriptions","organizations_url":"https://api.github.com/users/mdmush/orgs","repos_url":"https://api.github.com/users/mdmush/repos","events_url":"https://api.github.com/users/mdmush/events{/privacy}","received_events_url":"https://api.github.com/users/mdmush/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-09-03T10:44:59Z","updated_at":"2018-09-17T09:54:23Z","closed_at":null,"author_association":"NONE","body":"What `react-native` version are you using ?\r\nv0.56.0\r\nWhat `react-native-pdf` version are you using ?\r\nv5.0.2\r\nWhat platform dose your issue occur on? (android/ios/both)\r\niOS\r\nDescribe your issue as precisely as possible : \r\n  1) I'm getting this error when i'm providing a link of pdf file stored somewhere on the internet (yes! it is https). \r\n  2) 'Content-Length' in iOS is not the same as fileStats.size. You should check for something to get it right.\r\n  3) Below code is only working for android\r\n    `if (expectedContentLength != actualContentLength) {\r\n         throw new Error(\"DownloadFailed:\" + url);\r\n      }`\r\n       for ios, maybe you should limit it with Platform.OS\r\n  4) If we're doing like this: \r\n             \r\n\r\n                    try {\r\n                        const fileStats = await RNFetchBlob.fs.stat(res.path());\r\n                        console.log(fileStats);\r\n                        \r\n                        if (!fileStats || !fileStats.size) {\r\n                            throw new Error(\"FileNotFound\");\r\n                        }\r\n\r\n                        actualContentLength = fileStats.size;\r\n                    } catch (error) {\r\n                        throw new Error(\"DownloadFailed:\", error);\r\n                    }\r\n\r\n                    if(Platform.OS == 'android'){\r\n                        if (expectedContentLength != actualContentLength) {\r\n                            throw new Error(\"Wrong File Downloaded\");\r\n                        }\r\n                    }\r\n\r\n\r\nJoin a screenshot or video of the problem on the simulator or device ?\r\n\r\n**Old Code:** \r\n<img width=\"1212\" alt=\"screenshot 2018-09-03 at 4 10 00 pm\" src=\"https://user-images.githubusercontent.com/6891822/44982548-e9a8b080-af93-11e8-9147-ac08f908f174.png\">\r\n\r\n\r\n**My updated Code**\r\n<img width=\"1210\" alt=\"screenshot 2018-09-03 at 4 13 31 pm\" src=\"https://user-images.githubusercontent.com/6891822/44982684-591ea000-af94-11e8-9bc8-cf5fdb135989.png\">\r\n"},"comment":{"url":"https://api.github.com/repos/wonday/react-native-pdf/issues/comments/421950019","html_url":"https://github.com/wonday/react-native-pdf/issues/230#issuecomment-421950019","issue_url":"https://api.github.com/repos/wonday/react-native-pdf/issues/230","id":421950019,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTk1MDAxOQ==","user":{"login":"mdmush","id":6891822,"node_id":"MDQ6VXNlcjY4OTE4MjI=","avatar_url":"https://avatars1.githubusercontent.com/u/6891822?v=4","gravatar_id":"","url":"https://api.github.com/users/mdmush","html_url":"https://github.com/mdmush","followers_url":"https://api.github.com/users/mdmush/followers","following_url":"https://api.github.com/users/mdmush/following{/other_user}","gists_url":"https://api.github.com/users/mdmush/gists{/gist_id}","starred_url":"https://api.github.com/users/mdmush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdmush/subscriptions","organizations_url":"https://api.github.com/users/mdmush/orgs","repos_url":"https://api.github.com/users/mdmush/repos","events_url":"https://api.github.com/users/mdmush/events{/privacy}","received_events_url":"https://api.github.com/users/mdmush/received_events","type":"User","site_admin":false},"created_at":"2018-09-17T09:54:23Z","updated_at":"2018-09-17T09:54:23Z","author_association":"NONE","body":"> I fixed the code but can not test it, because no server that support gzip.\r\n> Can anyone test it?\r\n> \r\n> the code that I modified:\r\n> https://github.com/wonday/react-native-pdf/blob/master/index.js#L265\r\n> \r\n> ```\r\n>                 if (res && res.respInfo && res.respInfo.headers && !res.respInfo.headers[\"Content-Encoding\"] && !res.respInfo.headers[\"Transfer-Encoding\"] && res.respInfo.headers[\"Content-Length\"]) {\r\n> ```\r\n\r\nJust tested it in iOS. Now it's working fine. :)"}}
{"actor":{"display_login":"mdmush"}}