File picker button labels show HTML entities for file names with special characters

オープン 初心者向け
#2,770 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
frontend

調査の方向性

ピッカーボタンの既定のラベルが作成される lib/filepicker-builder.ts の218~241行目付近を読み、関連するラベルのテストを探してください。gettext がプレースホルダーの値をどのようにエスケープするか、またラベルがテキストとしてどのようにレンダリングされるかを確認してください。アポストロフィやアンパサンドを含む名前がそのまま表示されるようにラベルを更新し、これらの文字を対象とするテストを追加してください。

索引モデルが issue の本文から書いたものです。

説明

bug
Describe the bug

The file picker button labels that contain a file or folder name show HTML entities when the name contains characters like ', &, < or ", e.g. Choose Tom&#39;s folder or Copy to A &amp; B.

The labels are built with the gettext wrapper, which HTML-escapes placeholder values by default:

https://github.com/nextcloud-libraries/nextcloud-dialogs/blob/636c9a8ea2700380d4cd8d1b0b1d57d50850ab29/lib/filepicker-builder.ts#L218-L241

label = t('Choose {file}', { file: target })
// …
label: target ? t('Copy to {target}', { target }) : t('Copy'),
// …
label: target ? t('Move to {target}', { target }) : t('Move'),

The result is then rendered as plain button text (not as HTML), so the escaped entities are shown literally.

Originally reported in nextcloud/server#55191 for the "Set default folder for accepted shares" picker in the personal sharing settings, but it affects every picker using these default buttons (e.g. "Copy to …" / "Move to …" in the Files app).

To Reproduce

Found by code reading and the screenshot in nextcloud/server#55191.

  1. Create a folder named Tom's files.
  2. Open a file picker that uses the default buttons (e.g. "Move or copy" in Files) and select that folder.
  3. The button shows Copy to Tom&#39;s files.
Expected behavior

The labels show the plain name: either pass the placeholders unescaped (the labels are rendered as text, so no HTML escaping is needed there) or skip escaping for these button labels, with a test for a name containing ' and &.

主要言語
TypeScript
スター
19
フォーク
10
平均マージ
17時間 4分
マージ済み PR(30日)
30

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextcloud-libraries/nextcloud-dialogs のほかの issue

nextcloud-libraries/nextcloud-dialogs の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。