Skip to content

Commit

Permalink
リモートから添付されてきたクリップURLにホスト情報があると二重になる不具合を修正 (yojo-art#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozakura913 authored Sep 18, 2024
1 parent de66bbf commit 455e6e7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Cherrypick 4.11.1
- Fix: リアクションが閲覧できる状態でも見れない問題を修正 [#429](https://github.com/yojo-art/cherrypick/pull/429)
- Enhance: チャートの連合グラフで割合を表示
- Enhance: お気に入り登録クリップの一覧画面から登録解除できるように
- Fix: リモートから添付されてきたクリップURLにホスト情報があると二重になる不具合を修正 [#460](https://github.com/yojo-art/cherrypick/pull/460)

### Server
-
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/MkLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const props = withDefaults(defineProps<{
let self = props.url.startsWith(local);
let requestUrl = new URL(props.url);
if (props.host === requestUrl.host && requestUrl.pathname.startsWith('/clips/')) {
requestUrl = new URL(local + requestUrl.pathname + '@' + props.host);
let split = requestUrl.pathname.split('@');
requestUrl = new URL(local + split[0] + '@' + (split.length >= 2 ? split[1] : props.host));
self = true;
}
const url_string = requestUrl.toString();
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/MkUrlPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ let self = props.url.startsWith(local);
let requestUrl = new URL(props.url);
let url_string: string;
if (props.host === requestUrl.host && requestUrl.pathname.startsWith('/clips/')) {
requestUrl = new URL(local + requestUrl.pathname + '@' + props.host);
let split = requestUrl.pathname.split('@');
requestUrl = new URL(local + split[0] + '@' + (split.length >= 2 ? split[1] : props.host));
self = true;
url_string = requestUrl.toString();
requestUrl = new URL(props.url);
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/global/MkUrl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ let url = new URL(props.url);
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('invalid url');

if (props.host === url.host && url.pathname.startsWith('/clips/')) {
url = new URL(local + url.pathname + '@' + props.host);
let split = url.pathname.split('@');
url = new URL(local + split[0] + '@' + (split.length >= 2 ? split[1] : props.host));
self = true;
}
const url_string = url.toString();
Expand Down

0 comments on commit 455e6e7

Please sign in to comment.