Use patch in place of put in the indexer API call, ensure that files are not being required in the indexer path

This commit is contained in:
sabaimran 2024-07-29 22:42:43 +05:30 committed by Debanjum Singh Solanky
parent ffbf57292c
commit 4a7efdc552
3 changed files with 6 additions and 5 deletions

View file

@ -544,7 +544,7 @@ export default function SettingsView() {
const syncContent = async (type: string) => {
try {
const response = await fetch(`/api/content?t=${type}`, {
method: 'PUT',
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},

View file

@ -81,7 +81,7 @@ class IndexerInput(BaseModel):
@requires(["authenticated"])
async def put_content(
request: Request,
files: list[UploadFile],
files: Optional[List[UploadFile]] = [],
t: Optional[Union[state.SearchType, str]] = state.SearchType.All,
client: Optional[str] = None,
user_agent: Optional[str] = Header(None),
@ -103,7 +103,7 @@ async def put_content(
@requires(["authenticated"])
async def patch_content(
request: Request,
files: list[UploadFile],
files: Optional[List[UploadFile]] = [],
t: Optional[Union[state.SearchType, str]] = state.SearchType.All,
client: Optional[str] = None,
user_agent: Optional[str] = Header(None),

View file

@ -988,14 +988,15 @@ class ApiIndexedDataLimiter:
self.total_entries_size_limit = total_entries_size_limit
self.subscribed_total_entries_size = subscribed_total_entries_size_limit
def __call__(self, request: Request, files: List[UploadFile]):
def __call__(self, request: Request, files: List[UploadFile] = None):
if state.billing_enabled is False:
return
subscribed = has_required_scope(request, ["premium"])
incoming_data_size_mb = 0.0
deletion_file_names = set()
if not request.user.is_authenticated:
if not request.user.is_authenticated or not files:
return
user: KhojUser = request.user.object