Fix #241: 500 Error when submitting extension without "type" #242
@ -21,7 +21,13 @@ import clamd
|
||||
import magic
|
||||
import requests
|
||||
|
||||
from constants.base import THUMBNAIL_FORMAT, THUMBNAIL_SIZES, THUMBNAIL_QUALITY
|
||||
from constants.base import (
|
||||
EXTENSION_TYPE_CHOICES,
|
||||
EXTENSION_TYPE_SLUGS_SINGULAR,
|
||||
THUMBNAIL_FORMAT,
|
||||
THUMBNAIL_SIZES,
|
||||
THUMBNAIL_QUALITY,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
FORBIDDEN_FILEPATHS = [
|
||||
@ -201,13 +207,13 @@ def validate_file_list(toml_content, manifest_filepath, file_list):
|
||||
}
|
||||
)
|
||||
type_slug = toml_content['type']
|
||||
if type_slug == 'theme':
|
||||
if type_slug == EXTENSION_TYPE_SLUGS_SINGULAR[EXTENSION_TYPE_CHOICES.THEME]:
|
||||
theme_xmls = filter_paths_by_ext(file_list, '.xml')
|
||||
# Special treatment for Mac, so the same problem (__MACOSX folders)
|
||||
# doesn't lead to two errors showing.
|
||||
if len(list(theme_xmls)) != 1 and '__MACOSX/' not in found_forbidden_filepaths:
|
||||
error_codes.append('missing_or_multiple_theme_xml')
|
||||
elif type_slug == 'add-on':
|
||||
elif type_slug == EXTENSION_TYPE_SLUGS_SINGULAR[EXTENSION_TYPE_CHOICES.BPY]:
|
||||
# __init__.py is expected to be next to the manifest
|
||||
expected_init_path = _canonical_path('__init__.py', manifest_filepath)
|
||||
init_filepath = find_exact_path(file_list, expected_init_path)
|
||||
|
Loading…
Reference in New Issue
Block a user