mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-24 17:35:39 +00:00
Add check for empty file write
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.browser.file;
|
||||
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.window.AppDialog;
|
||||
import io.xpipe.app.ext.ConnectionFileSystem;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
@@ -29,6 +30,16 @@ public class BrowserFileOpener {
|
||||
return OutputStream.nullOutputStream();
|
||||
}
|
||||
|
||||
if (totalBytes == 0) {
|
||||
var existingSize = model.getFileSystem().getFileSize(file.getPath());
|
||||
if (existingSize != 0) {
|
||||
var blank = AppDialog.confirm("fileWriteBlankTitle", AppI18n.observable("fileWriteBlankContent", file.getPath()));
|
||||
if (!blank) {
|
||||
return OutputStream.nullOutputStream();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sc = fileSystem.getShell().get();
|
||||
if (sc.getOsType() == OsType.WINDOWS) {
|
||||
return fileSystem.openOutput(file.getPath(), totalBytes);
|
||||
|
||||
Generated
+2
@@ -497,6 +497,8 @@ yellow=Gul
|
||||
blue=Blå
|
||||
red=Rød
|
||||
asktextAlertTitle=Spørg
|
||||
fileWriteBlankTitle=Bekræft sletning af fil
|
||||
fileWriteBlankContent=Vil du slette filindholdet på $FILE$ og skrive en tom fil? Hvis du ikke havde tænkt dig at gøre det, kan du annullere denne handling.
|
||||
fileWriteSudoTitle=Sudo filskrivning
|
||||
fileWriteSudoContent=Den fil, du forsøger at skrive, kræver root-rettigheder. Vil du skrive denne fil med sudo? Dette vil automatisk hæve niveauet til root med enten de angivne legitimationsoplysninger eller via en prompt.
|
||||
dontAllowTerminalRestart=Tillad ikke genstart af terminal
|
||||
|
||||
Generated
+2
@@ -500,6 +500,8 @@ yellow=Gelb
|
||||
blue=Blau
|
||||
red=Rot
|
||||
asktextAlertTitle=Eingabeaufforderung
|
||||
fileWriteBlankTitle=Bestätigen Sie das Löschen von Dateien
|
||||
fileWriteBlankContent=Willst du den Dateiinhalt von $FILE$ löschen und eine leere Datei schreiben? Wenn du das nicht vorhattest, kannst du diesen Vorgang abbrechen.
|
||||
fileWriteSudoTitle=Sudo-Datei schreiben
|
||||
fileWriteSudoContent=Die Datei, die du zu schreiben versuchst, erfordert Root-Rechte. Willst du diese Datei mit sudo schreiben? Damit wirst du entweder mit den angegebenen Anmeldeinformationen oder über eine Eingabeaufforderung automatisch zu root befördert.
|
||||
dontAllowTerminalRestart=Terminal-Neustart nicht zulassen
|
||||
|
||||
Generated
+2
-1
@@ -509,6 +509,8 @@ yellow=Yellow
|
||||
blue=Blue
|
||||
red=Red
|
||||
asktextAlertTitle=Prompt
|
||||
fileWriteBlankTitle=Confirm file erase
|
||||
fileWriteBlankContent=Do you want to erase the file contents of $FILE$ and write an empty file? If you didn't intend to do this, you can cancel this operation.
|
||||
fileWriteSudoTitle=Sudo file write
|
||||
fileWriteSudoContent=The file you are trying to write requires root privileges. Do you want to write this file with sudo? This will automatically elevate to root with either the provided credentials or via a prompt.
|
||||
dontAllowTerminalRestart=Don't allow terminal restart
|
||||
@@ -1397,7 +1399,6 @@ refreshOpenpubkey=Refresh openpubkey identity
|
||||
refreshOpenpubkeyDescription=Run opkssh refresh to make the openpubkey identity valid again
|
||||
all=All
|
||||
terminalPrompt=Terminal prompt
|
||||
#force
|
||||
terminalPromptDescription=The terminal prompt tool to use in your remote terminals. Enabling a terminal prompt will automatically set up and configure the prompt tool on the target system when opening a terminal session.\n\nThis does not modify any existing prompt configurations or profile files on a system. This will increase the terminal loading time for the first time while the prompt is being set up on the remote system. Your terminal might need a special font from https://github.com/ryanoasis/nerd-fonts to display the prompt correctly.
|
||||
terminalPromptConfiguration=Terminal prompt configuration
|
||||
terminalPromptConfig=Config file
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Amarillo
|
||||
blue=Azul
|
||||
red=Rojo
|
||||
asktextAlertTitle=Pregunta
|
||||
fileWriteBlankTitle=Confirmar borrado de archivo
|
||||
fileWriteBlankContent=¿Quieres borrar el contenido del archivo $FILE$ y escribir un archivo vacío? Si no tenías intención de hacerlo, puedes cancelar esta operación.
|
||||
fileWriteSudoTitle=Escritura de archivos Sudo
|
||||
fileWriteSudoContent=El archivo que intentas escribir requiere privilegios de root. ¿Quieres escribir este archivo con sudo? Esto elevará automáticamente a root con las credenciales proporcionadas o a través de un prompt.
|
||||
dontAllowTerminalRestart=No permitir el reinicio del terminal
|
||||
|
||||
Generated
+2
@@ -497,6 +497,8 @@ yellow=Jaune
|
||||
blue=Bleu
|
||||
red=Rouge
|
||||
asktextAlertTitle=Invite
|
||||
fileWriteBlankTitle=Confirmer l'effacement d'un fichier
|
||||
fileWriteBlankContent=Veux-tu effacer le contenu du fichier $FILE$ et écrire un fichier vide ? Si tu n'avais pas l'intention de le faire, tu peux annuler cette opération.
|
||||
fileWriteSudoTitle=Sudo file write
|
||||
fileWriteSudoContent=Le fichier que tu essaies d'écrire nécessite les privilèges de root. Veux-tu écrire ce fichier avec sudo ? Cela te permettra d'obtenir automatiquement les privilèges de root, soit avec les informations d'identification fournies, soit par le biais d'une invite.
|
||||
dontAllowTerminalRestart=Ne pas autoriser le redémarrage du terminal
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Kuning
|
||||
blue=Biru
|
||||
red=Merah
|
||||
asktextAlertTitle=Prompt
|
||||
fileWriteBlankTitle=Mengonfirmasi penghapusan file
|
||||
fileWriteBlankContent=Apakah Anda ingin menghapus isi file $FILE$ dan menulis file kosong? Jika Anda tidak berniat melakukan hal ini, Anda dapat membatalkan operasi ini.
|
||||
fileWriteSudoTitle=Menulis file Sudo
|
||||
fileWriteSudoContent=Berkas yang ingin Anda tulis memerlukan hak akses root. Apakah Anda ingin menulis berkas ini dengan sudo? Ini akan secara otomatis meningkatkannya menjadi root dengan kredensial yang disediakan atau melalui prompt.
|
||||
dontAllowTerminalRestart=Jangan izinkan pengaktifan ulang terminal
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Giallo
|
||||
blue=Blu
|
||||
red=Rosso
|
||||
asktextAlertTitle=Prompt
|
||||
fileWriteBlankTitle=Conferma la cancellazione di un file
|
||||
fileWriteBlankContent=Vuoi cancellare il contenuto del file $FILE$ e scrivere un file vuoto? Se non hai intenzione di farlo, puoi annullare questa operazione.
|
||||
fileWriteSudoTitle=Scrittura di file Sudo
|
||||
fileWriteSudoContent=Il file che stai cercando di scrivere richiede i privilegi di root. Vuoi scrivere questo file con sudo? In questo modo si passa automaticamente a root con le credenziali fornite o tramite un prompt.
|
||||
dontAllowTerminalRestart=Non consentire il riavvio del terminale
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=黄色
|
||||
blue=ブルー
|
||||
red=赤い
|
||||
asktextAlertTitle=プロンプト
|
||||
fileWriteBlankTitle=ファイルの消去を確認する
|
||||
fileWriteBlankContent=$FILE$ 、ファイルの内容を消去し、空のファイルを書き込むか?そのつもりがなければ、この操作はキャンセルできる。
|
||||
fileWriteSudoTitle=須藤ファイル書き込み
|
||||
fileWriteSudoContent=書き込もうとしているファイルにはroot権限が必要だ。このファイルをsudoで書き込むか?これは、提供された認証情報またはプロンプト経由で自動的にrootに昇格する。
|
||||
dontAllowTerminalRestart=端末の再起動を許可しない
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=노란색
|
||||
blue=파란색
|
||||
red=빨간색
|
||||
asktextAlertTitle=프롬프트
|
||||
fileWriteBlankTitle=파일 삭제 확인
|
||||
fileWriteBlankContent=$FILE$ 의 파일 내용을 지우고 빈 파일을 작성하시겠습니까? 이 작업을 수행할 의도가 아니라면 이 작업을 취소할 수 있습니다.
|
||||
fileWriteSudoTitle=자동 파일 쓰기
|
||||
fileWriteSudoContent=쓰려는 파일에 루트 권한이 필요합니다. Sudo로 이 파일을 작성하시겠습니까? 그러면 제공된 자격 증명을 사용하거나 프롬프트를 통해 자동으로 루트로 승격됩니다.
|
||||
dontAllowTerminalRestart=터미널 재시작 허용 안 함
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Geel
|
||||
blue=Blauw
|
||||
red=Rood
|
||||
asktextAlertTitle=Prompt
|
||||
fileWriteBlankTitle=Bestand wissen bevestigen
|
||||
fileWriteBlankContent=Wil je de bestandsinhoud van $FILE$ wissen en een leeg bestand schrijven? Als je dit niet van plan was, kun je deze bewerking annuleren.
|
||||
fileWriteSudoTitle=Sudo bestand schrijven
|
||||
fileWriteSudoContent=Voor het bestand dat je probeert te schrijven heb je rootrechten nodig. Wil je dit bestand schrijven met sudo? Dit zal je automatisch verheffen tot root met de verstrekte inloggegevens of via een prompt.
|
||||
dontAllowTerminalRestart=Terminal opnieuw opstarten niet toestaan
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Żółty
|
||||
blue=Niebieski
|
||||
red=Czerwony
|
||||
asktextAlertTitle=Podpowiedź
|
||||
fileWriteBlankTitle=Potwierdź usunięcie pliku
|
||||
fileWriteBlankContent=Czy chcesz usunąć zawartość pliku $FILE$ i zapisać pusty plik? Jeśli nie zamierzasz tego robić, możesz anulować tę operację.
|
||||
fileWriteSudoTitle=Zapis pliku Sudo
|
||||
fileWriteSudoContent=Plik, który próbujesz zapisać, wymaga uprawnień roota. Czy chcesz zapisać ten plik z sudo? Spowoduje to automatyczne podniesienie uprawnień do roota za pomocą podanych poświadczeń lub za pomocą monitu.
|
||||
dontAllowTerminalRestart=Nie zezwalaj na ponowne uruchomienie terminala
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Amarelo
|
||||
blue=Azul
|
||||
red=Vermelho
|
||||
asktextAlertTitle=Prompt
|
||||
fileWriteBlankTitle=Confirma a eliminação de ficheiros
|
||||
fileWriteBlankContent=Queres apagar o conteúdo do ficheiro $FILE$ e escrever um ficheiro vazio? Se não pretendias fazer isto, podes cancelar esta operação.
|
||||
fileWriteSudoTitle=Escreve um ficheiro Sudo
|
||||
fileWriteSudoContent=O ficheiro que estás a tentar escrever requer privilégios de root. Queres escrever este ficheiro com o sudo? Isto irá automaticamente elevar-te a root com as credenciais fornecidas ou através de um prompt.
|
||||
dontAllowTerminalRestart=Não permitir o reinício do terminal
|
||||
|
||||
Generated
+3
-1
@@ -483,6 +483,8 @@ yellow=Желтый
|
||||
blue=Синий
|
||||
red=Красный
|
||||
asktextAlertTitle=Prompt
|
||||
fileWriteBlankTitle=Подтверждение стирания файла
|
||||
fileWriteBlankContent=Хочешь стереть содержимое файла $FILE$ и записать пустой файл? Если ты не собирался этого делать, то можешь отменить эту операцию.
|
||||
fileWriteSudoTitle=Запись файла Sudo
|
||||
fileWriteSudoContent=Файл, который ты пытаешься записать, требует привилегий root. Хочешь ли ты записать этот файл с помощью sudo? Это автоматически повысит права до root либо с помощью предоставленных учетных данных, либо через приглашение.
|
||||
dontAllowTerminalRestart=Не разрешайте перезагрузку терминала
|
||||
@@ -1332,7 +1334,7 @@ refreshOpenpubkey=Обновите идентификатор openpubkey
|
||||
refreshOpenpubkeyDescription=Запустите opkssh refresh, чтобы идентификатор openpubkey снова стал действительным
|
||||
all=Все
|
||||
terminalPrompt=Подсказка терминала
|
||||
terminalPromptDescription=Инструмент подсказки терминала, который будет использоваться в твоих удаленных терминалах. Включение подсказки терминала автоматически установит и настроит инструмент подсказки на целевой системе при открытии терминальной сессии.\n\nПри этом не изменяются существующие конфигурации подсказок или файлы профилей в системе. Это увеличит время загрузки терминала в первое время, пока подсказка будет настраиваться на удаленной системе. Твоему терминалу может понадобиться специальный шрифт с сайта https://github.com/ryanoasis/nerd-fonts для корректного отображения подсказки.
|
||||
terminalPromptDescription=Инструмент подсказки терминала, который будет использоваться в твоих удаленных терминалах. Включение подсказки терминала автоматически установит и настроит инструмент подсказки на целевой системе при открытии терминальной сессии.\n\nПри этом не изменяются существующие конфигурации подсказок или файлы профилей в системе. Это увеличит время загрузки терминала в первое время, пока подсказка будет настраиваться на удаленной системе. Твоему терминалу может потребоваться специальный шрифт с сайта https://github.com/ryanoasis/nerd-fonts для корректного отображения подсказки.
|
||||
terminalPromptConfiguration=Настройка подсказки терминала
|
||||
terminalPromptConfig=Конфигурационный файл
|
||||
terminalPromptConfigDescription=Файл пользовательского конфига, который нужно применить к подсказке. Этот конфиг будет автоматически установлен на целевой системе при инициализации терминала и использован в качестве конфига подсказки по умолчанию.\n\nЕсли ты хочешь использовать существующий файл конфига по умолчанию на каждой системе, можешь оставить это поле пустым.
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Gul
|
||||
blue=Blå
|
||||
red=Röd
|
||||
asktextAlertTitle=Uppmaning
|
||||
fileWriteBlankTitle=Bekräfta radering av fil
|
||||
fileWriteBlankContent=Vill du radera filinnehållet i $FILE$ och skriva en tom fil? Om du inte hade för avsikt att göra detta, kan du avbryta denna operation.
|
||||
fileWriteSudoTitle=Sudo filskrivning
|
||||
fileWriteSudoContent=Filen som du försöker skriva kräver root-behörighet. Vill du skriva den här filen med sudo? Detta kommer automatiskt att höja till root med antingen de angivna autentiseringsuppgifterna eller via en prompt.
|
||||
dontAllowTerminalRestart=Tillåt inte omstart av terminal
|
||||
|
||||
Generated
+2
@@ -483,6 +483,8 @@ yellow=Sarı
|
||||
blue=Mavi
|
||||
red=Kırmızı
|
||||
asktextAlertTitle=İstem
|
||||
fileWriteBlankTitle=Dosya silmeyi onayla
|
||||
fileWriteBlankContent=$FILE$ adresindeki dosya içeriğini silmek ve boş bir dosya yazmak mı istiyorsunuz? Eğer bunu yapmak istemiyorsanız, bu işlemi iptal edebilirsiniz.
|
||||
fileWriteSudoTitle=Sudo dosya yazma
|
||||
fileWriteSudoContent=Yazmaya çalıştığınız dosya root ayrıcalıkları gerektiriyor. Bu dosyayı sudo ile yazmak istiyor musunuz? Bu, sağlanan kimlik bilgileriyle veya bir komut istemi aracılığıyla otomatik olarak root'a yükselecektir.
|
||||
dontAllowTerminalRestart=Terminalin yeniden başlatılmasına izin verme
|
||||
|
||||
Generated
+2
@@ -563,6 +563,8 @@ yellow=黄色
|
||||
blue=蓝色
|
||||
red=红色
|
||||
asktextAlertTitle=提示
|
||||
fileWriteBlankTitle=确认文件擦除
|
||||
fileWriteBlankContent=您想删除$FILE$ 中的文件内容并写入一个空文件吗?如果您不打算这样做,可以取消此操作。
|
||||
#custom
|
||||
fileWriteSudoTitle=以 Sudo 权限写入文件
|
||||
fileWriteSudoContent=您要写入的文件需要 root 权限。你想用 sudo 来写这个文件吗?这将通过提供的凭证或提示自动提升为 root 权限。
|
||||
|
||||
Reference in New Issue
Block a user