<commit_before>'use strict';

streamaApp.controller('modalFileCtrl', [
  '$scope', '$uibModalInstance', 'apiService', 'uploadService', 'video',
  function ($scope, $uibModalInstance, apiService, uploadService, video) {
    $scope.loading = false;


    //$uibModalInstance.close(data);

    $scope.video = video;

    $scope.addExternalUrl = function (externalUrl) {
      apiService.video.addExternalUrl({id: $scope.video.id, externalUrl: externalUrl}).success(function (data) {
        alertify.success("External Url Added.");
        //$scope.video.files.push(data);
        $scope.video.externalLink = null;

        if(_.find($scope.video.files, {id: data.id})){
          $scope.video.files[_.indexOf($scope.video.files, {id: data.id})] = data;
        }else{
          $scope.video.files.push(data);
        }
      });
    };

    $scope.cancel = function () {
      $uibModalInstance.dismiss('cancel');
    };

    $scope.removeFile = function (file) {<commit_msg>fixed nullpointer when pushing externalUrl into files array<commit_after>'use strict';

streamaApp.controller('modalFileCtrl', [
  '$scope', '$uibModalInstance', 'apiService', 'uploadService', 'video',
  function ($scope, $uibModalInstance, apiService, uploadService, video) {
    $scope.loading = false;


    //$uibModalInstance.close(data);

    $scope.video = video;

    $scope.addExternalUrl = function (externalUrl) {
      apiService.video.addExternalUrl({id: $scope.video.id, externalUrl: externalUrl}).success(function (data) {
        alertify.success("External Url Added.");
        //$scope.video.files.push(data);
        $scope.video.externalLink = null;

        if(_.find($scope.video.files, {id: data.id})){
          $scope.video.files[_.indexOf($scope.video.files, {id: data.id})] = data;
        }else{
          $scope.video.files = $scope.video.files || [];
          $scope.video.files.push(data);
        }
      });
    };

    $scope.cancel = function () {
      $uibModalInstance.dismiss('cancel');
    };

    $scope.removeFile = function (file) {
{'fraction_non_alphanumeric': 0.16691068814055637, 'fraction_numerical': 0.0, 'mean_word_length': 3.175152749490835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1691519', 'n_tokens_mistral': 643, 'n_tokens_neox': 624, 'n_words': 105}