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

iOS ~16.2 환경에서 심플에디터의 유튜브 일반화 코드 작동 안됨 #2181

Closed
nemorize opened this issue Sep 14, 2023 · 2 comments
Labels
bug 버그로 확인된 사항 patch available 패치 있음 표시 (bug와 함께 사용)

Comments

@nemorize
Copy link
Contributor

var convertYouTube = function(str) {
var regexp = /(?<!src=")https?:\/\/(www\.youtube(?:-nocookie)?\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]+)\S*/g;
var embed = '<iframe width="560" height="315" src="https://www.youtube.com/embed/$2" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe><p></p>';
return String(str).replace(regexp, embed);
};

https://bugs.webkit.org/show_bug.cgi?id=174931
후방탐색 정규표현식 사용이 불가능한 문제이고, 유튜브 일반화 코드에 해당 코드가 포함되어 문제가 발생합니다.

구버전 OS/브라우저에 대한 문제라 반영이 될지 잘 모르겠습니다만,
JS 전체를 블락시켜버려서 (아마도 JS 합치기 설정이 되어 있는 경우) 상황에 따라 매우 곤란할 수 있을 것 같네요.

@kijin kijin added the bug 버그로 확인된 사항 label Sep 14, 2023
@kijin
Copy link
Member

kijin commented Sep 15, 2023

negative lookback assertion에 의존하지 않고 콜백함수를 사용하여 구현해 보았습니다.
31253cd 테스트 부탁드립니다.

@kijin kijin added the patch available 패치 있음 표시 (bug와 함께 사용) label Sep 15, 2023
@nemorize
Copy link
Contributor Author

LGTM 😄

@kijin kijin closed this as completed in 31253cd Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 버그로 확인된 사항 patch available 패치 있음 표시 (bug와 함께 사용)
Projects
None yet
Development

No branches or pull requests

2 participants