Skip to content

Commit 1cf7318

Browse files
committed
feat(files): show hidden new file name warning
Signed-off-by: skjnldsv <[email protected]>
1 parent 90c2bba commit 1cf7318

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

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
*/

0 commit comments

Comments
 (0)