Skip to content

Commit 3ad2409

Browse files
added input validation
added validation for file extension
1 parent a95abed commit 3ad2409

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

copyleaks/copyleaks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ def submit_file(auth_token, scan_id, submission):
156156
`UnderMaintenanceError`: Copyleaks servers are unavailable for maintenance. We recommend to implement exponential backoff algorithm as described here: https://api.copyleaks.com/documentation/v3/exponential-backoff
157157
'''
158158
file_extension = os.path.splitext(submission.filename)[1].lstrip('.').lower()
159-
159+
160+
if not file_extension:
161+
raise ValueError(f"File extension could not be determined for filename: {submission.filename}")
162+
160163
if file_extension in SupportedFilesTypes.SUPPORTED_CODE_EXTENSIONS:
161164
deprecationService.show_deprecation_message()
162165

0 commit comments

Comments
 (0)