Skip to content

Commit 2cbfdcc

Browse files
authored
Merge pull request #53984 from nextcloud/feat/hint-hidden
fix(files): show hidden new file name warning
2 parents 37e401e + 0cfc35f commit 2cbfdcc

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

apps/files/src/components/NewNodeDialog.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
:helper-text="validity"
2727
:label="label"
2828
:value.sync="localDefaultName" />
29+
30+
<!-- Hidden file warning -->
31+
<NcNoteCard v-if="isHiddenFileName"
32+
type="warning"
33+
:text="t('files', 'Files starting with a dot are hidden by default')" />
2934
</form>
3035
</NcDialog>
3136
</template>
@@ -35,12 +40,13 @@ import type { ComponentPublicInstance, PropType } from 'vue'
3540
import { getUniqueName } from '@nextcloud/files'
3641
import { t } from '@nextcloud/l10n'
3742
import { extname } from 'path'
38-
import { nextTick, onMounted, ref, watch, watchEffect } from 'vue'
43+
import { computed, nextTick, onMounted, ref, watch, watchEffect } from 'vue'
3944
import { getFilenameValidity } from '../utils/filenameValidity.ts'
4045
4146
import NcButton from '@nextcloud/vue/components/NcButton'
4247
import NcDialog from '@nextcloud/vue/components/NcDialog'
4348
import NcTextField from '@nextcloud/vue/components/NcTextField'
49+
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
4450
4551
const props = defineProps({
4652
/**
@@ -89,6 +95,11 @@ const nameInput = ref<ComponentPublicInstance>()
8995
const formElement = ref<HTMLFormElement>()
9096
const validity = ref('')
9197
98+
const isHiddenFileName = computed(() => {
99+
// Check if the name starts with a dot, which indicates a hidden file
100+
return localDefaultName.value.trim().startsWith('.')
101+
})
102+
92103
/**
93104
* Focus the filename input field
94105
*/

dist/files-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)