Skip to content

Commit

Permalink
Fixed some issues with the import feature (#222)
Browse files Browse the repository at this point in the history
* Fix upload logic to avoid process cannot access the file errors

* Remove unnecessary slashes

* Add request limits config for import feature

* Switching to ContinousDelivery mode for now?
  • Loading branch information
Jonathan Mezach committed Jun 4, 2020
1 parent 8ae1d62 commit 3257a6f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
@@ -1,5 +1,5 @@
next-version: 2.7.0
mode: Mainline
mode: ContinuousDelivery
branches:
dependabot:
regex: ˆdependabot?[/-]
Expand Down
34 changes: 17 additions & 17 deletions src/Augurk/Controllers/V2/AugurkController.cs
Expand Up @@ -128,29 +128,29 @@ public async Task<ActionResult> Import(IFormFile file)
{
// Copy file to temporary location
await file.CopyToAsync(stream);
}

// Perform import
var importOptions = new DatabaseSmugglerImportOptions()
{
OperateOnTypes = DatabaseItemType.Documents,
IncludeExpired = false,
};
// Perform import
var importOptions = new DatabaseSmugglerImportOptions()
{
OperateOnTypes = DatabaseItemType.Documents,
IncludeExpired = false,
};

var operation = await _documentStore.Smuggler.ImportAsync(importOptions, filePath);
await operation.WaitForCompletionAsync();
var operation = await _documentStore.Smuggler.ImportAsync(importOptions, filePath);
await operation.WaitForCompletionAsync();

// Delete temporary file
System.IO.File.Delete(filePath);
// Delete temporary file
System.IO.File.Delete(filePath);

// Set the expirations as configured
// TODO Restore functionality
// await _expirationManager.ApplyExpirationPolicyAsync(await _configurationManager.GetOrCreateConfigurationAsync());
// Set the expirations as configured
// TODO Restore functionality
// await _expirationManager.ApplyExpirationPolicyAsync(await _configurationManager.GetOrCreateConfigurationAsync());

// Migrate the imported data asynchronously
var taskWeShallNotWaitFor = _migrationManager.StartMigrating();
// Migrate the imported data asynchronously
var taskWeShallNotWaitFor = _migrationManager.StartMigrating();

return NoContent();
}
return NoContent();
}

/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions src/Augurk/web.config
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
4 changes: 2 additions & 2 deletions src/Augurk/wwwroot/app/controllers.js
Expand Up @@ -229,7 +229,7 @@ AugurkControllers.controller('configurationController', ['$rootScope', '$scope',
var ajaxRequest = $.ajax({
cache: false,
type: 'POST',
url: '/api/v2/import',
url: 'api/v2/import',
contentType: false,
processData: false,
data: formData
Expand All @@ -243,7 +243,7 @@ AugurkControllers.controller('configurationController', ['$rootScope', '$scope',
};

$scope.export = function () {
window.open('/api/v2/export', '_blank', '');
window.open('api/v2/export', '_blank', '');
};
}
]);
Expand Down

0 comments on commit 3257a6f

Please sign in to comment.