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>
|
||||
</template>
|
||||
<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
|
||||
v-model="selectedConfigPaths"
|
||||
:items="configFileItems"
|
||||
:show-size="false"
|
||||
:show-modified="false"
|
||||
@navigate="scrollConfigFileTreeToTop"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,6 +76,7 @@ const emit = defineEmits<{
|
||||
const { formatMessage } = useVIntl()
|
||||
const { notifySharedInstanceError, notifySharedInstanceUnavailable } = useSharedInstanceErrors()
|
||||
const publishReviewModal = ref<InstanceType<typeof ContentDiffModal>>()
|
||||
const configFileTreeContainer = ref<HTMLElement>()
|
||||
const publishDiffs = ref<ContentDiffItem[]>([])
|
||||
const configFilePaths = ref<string[]>([])
|
||||
const selectedConfigPaths = ref<string[]>([])
|
||||
@@ -132,6 +134,12 @@ async function publishChanges() {
|
||||
}
|
||||
}
|
||||
|
||||
function scrollConfigFileTreeToTop() {
|
||||
if (configFileTreeContainer.value) {
|
||||
configFileTreeContainer.value.scrollTop = 0
|
||||
}
|
||||
}
|
||||
|
||||
function finishReview() {
|
||||
if (state.value === 'reviewing') {
|
||||
setState('idle')
|
||||
|
||||
@@ -836,11 +836,29 @@ async fn config_bundle_bytes(
|
||||
entries: &BTreeMap<String, Vec<u8>>,
|
||||
) -> crate::Result<Vec<u8>> {
|
||||
if entries.len() > MAX_CONFIG_BUNDLE_ENTRIES {
|
||||
return Err(crate::ErrorKind::InputError(
|
||||
"Shared instance config bundle contains too many entries"
|
||||
.to_string(),
|
||||
)
|
||||
.into());
|
||||
let mut folder_entry_counts = HashMap::new();
|
||||
for path in entries.keys() {
|
||||
if let Some((folder, _)) = path.split_once('/') {
|
||||
*folder_entry_counts.entry(folder).or_insert(0_usize) += 1;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
for bytes in entries.values() {
|
||||
|
||||
Reference in New Issue
Block a user