mirror of
https://github.com/modrinth/code.git
synced 2026-07-31 13:16:38 +00:00
fix: feedback file limit (#6931)
* fix: feedback file limit * prepr * prepr again --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -26,12 +26,13 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<div class="flex min-w-0 flex-col gap-3 pt-4">
|
<div class="flex min-w-0 flex-col gap-3 pt-4">
|
||||||
<div class="max-h-[292px] overflow-y-auto rounded-[20px]">
|
<div ref="configFileTreeContainer" class="max-h-[292px] overflow-y-auto rounded-[20px]">
|
||||||
<FileTreeSelect
|
<FileTreeSelect
|
||||||
v-model="selectedConfigPaths"
|
v-model="selectedConfigPaths"
|
||||||
:items="configFileItems"
|
:items="configFileItems"
|
||||||
:show-size="false"
|
:show-size="false"
|
||||||
:show-modified="false"
|
:show-modified="false"
|
||||||
|
@navigate="scrollConfigFileTreeToTop"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,6 +76,7 @@ const emit = defineEmits<{
|
|||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
const { notifySharedInstanceError, notifySharedInstanceUnavailable } = useSharedInstanceErrors()
|
const { notifySharedInstanceError, notifySharedInstanceUnavailable } = useSharedInstanceErrors()
|
||||||
const publishReviewModal = ref<InstanceType<typeof ContentDiffModal>>()
|
const publishReviewModal = ref<InstanceType<typeof ContentDiffModal>>()
|
||||||
|
const configFileTreeContainer = ref<HTMLElement>()
|
||||||
const publishDiffs = ref<ContentDiffItem[]>([])
|
const publishDiffs = ref<ContentDiffItem[]>([])
|
||||||
const configFilePaths = ref<string[]>([])
|
const configFilePaths = ref<string[]>([])
|
||||||
const selectedConfigPaths = ref<string[]>([])
|
const selectedConfigPaths = ref<string[]>([])
|
||||||
@@ -132,6 +134,12 @@ async function publishChanges() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrollConfigFileTreeToTop() {
|
||||||
|
if (configFileTreeContainer.value) {
|
||||||
|
configFileTreeContainer.value.scrollTop = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function finishReview() {
|
function finishReview() {
|
||||||
if (state.value === 'reviewing') {
|
if (state.value === 'reviewing') {
|
||||||
setState('idle')
|
setState('idle')
|
||||||
|
|||||||
@@ -836,11 +836,29 @@ async fn config_bundle_bytes(
|
|||||||
entries: &BTreeMap<String, Vec<u8>>,
|
entries: &BTreeMap<String, Vec<u8>>,
|
||||||
) -> crate::Result<Vec<u8>> {
|
) -> crate::Result<Vec<u8>> {
|
||||||
if entries.len() > MAX_CONFIG_BUNDLE_ENTRIES {
|
if entries.len() > MAX_CONFIG_BUNDLE_ENTRIES {
|
||||||
return Err(crate::ErrorKind::InputError(
|
let mut folder_entry_counts = HashMap::new();
|
||||||
"Shared instance config bundle contains too many entries"
|
for path in entries.keys() {
|
||||||
.to_string(),
|
if let Some((folder, _)) = path.split_once('/') {
|
||||||
)
|
*folder_entry_counts.entry(folder).or_insert(0_usize) += 1;
|
||||||
.into());
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some((folder, count)) = folder_entry_counts
|
||||||
|
.into_iter()
|
||||||
|
.filter(|(_, count)| *count > MAX_CONFIG_BUNDLE_ENTRIES)
|
||||||
|
.max_by_key(|(_, count)| *count)
|
||||||
|
{
|
||||||
|
return Err(crate::ErrorKind::InputError(format!(
|
||||||
|
"The \"{folder}\" config folder has too many files to share ({count}; maximum {MAX_CONFIG_BUNDLE_ENTRIES}). Select fewer files from this folder."
|
||||||
|
))
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Err(crate::ErrorKind::InputError(format!(
|
||||||
|
"Too many config files were selected to share ({}; maximum {MAX_CONFIG_BUNDLE_ENTRIES}). Select fewer files.",
|
||||||
|
entries.len()
|
||||||
|
))
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
let mut total_size = 0_u64;
|
let mut total_size = 0_u64;
|
||||||
for bytes in entries.values() {
|
for bytes in entries.values() {
|
||||||
|
|||||||
Reference in New Issue
Block a user