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

Fix: 인스타그램 등 일부 도메인에서 이미지 조회가 안되는 문제 수정 #153

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

ShapeKim98
Copy link
Contributor

#️⃣연관된 이슈

ex) #이슈번호, #이슈번호
#152

📝작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)

  • 인스타그램 도메인을 가진 url에서 이미지 조회가 안되는 문제를 수정하였습니다.
    +++++++++++++++++++++++
  • App과 Share Extension의 버전을 맞췄습니다.

스크린샷 (선택)

💬리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

인스타그램 도메인을 가진 url에서 이미지 조회가 안되는 문제를 수정하였습니다.

  • 저희는 Nuke를 쓰고 있기 때문에, 뷰 단에서 User-Agent 헤더 값을 가진 요청을 만들어 LazyImage에 주입시켰습니다.
@MainActor
private func thumbleNail(url: URL) -> some View {
    var request = URLRequest(url: url)
    request.setValue(
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36",
        forHTTPHeaderField: "User-Agent"
    )
    
    return LazyImage(request: .init(urlRequest: request)) { phase in
        Group {
            if let image = phase.image {
                image
                    .resizable()
                    .aspectRatio(contentMode: .fill)
            } else {
                placeholder
            }
        }
...
  • 이렇게 User-Agent를 설정하게 되면, 해당 서비스에서 일반적인 브라우저(사파리, 크롬 등)에서 요청하는 것으로 인식해서 조회가 된다고 합니다.
  • User-Agent를 설정하면 인스타그램은 되지만, 유튜브가 안되는 문제가 있었는데(SwiftSoupClinet 작업 당시) 지금은 문제 없이 되고 있는거 같아 일단 이렇게 수정하고, 외부 베타를 통해 지켜볼 예정입니다.

추가적으로 AppShare Extension의 버전을 급히 맞췄습니다

  • 이거 안맞추면 심사 거절 날 수 도 있다고 해서... 이번 이슈는 아니지만 급하게 추가하였습니다..🙏

close #152

@ShapeKim98 ShapeKim98 added the Bug 현재 발견된 버그를 수정하기 위함 label Oct 22, 2024
@ShapeKim98 ShapeKim98 self-assigned this Oct 22, 2024
@ShapeKim98 ShapeKim98 merged commit 809268a into develop Oct 22, 2024
1 check passed
@stealmh stealmh linked an issue Oct 24, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 현재 발견된 버그를 수정하기 위함
Projects
None yet
Development

Successfully merging this pull request may close these issues.

일부 url에서 이미지 조회가 안되는 문제
2 participants