<commit_before>var File = require('core/models/file');

module.exports = File.extend({
  defaults: function() {
    return _.extend(File.prototype.defaults(), {
      type: 'link'
    });
  },

  getExtension: function() {
    return _.last(this.get('content').split('.')).replace(/\/.+|\//, '');
  }
});<commit_msg>Validate url field when creating link cards.<commit_after>var File = require('core/models/file');

module.exports = File.extend({
  defaults: function() {
    return _.extend(File.prototype.defaults(), {
      type: 'link'
    });
  },

  validations: _.extend({}, File.prototype.validations, {
    content: function(content) {
      if (!content) {
        return 'Every card requires some type of content.';
      } else if (!Z.Validations.isUrl(content)) {
        return 'Please provide a valid url.';
      }
    }
  }),

  getExtension: function() {
    return _.last(this.get('content').split('.')).replace(/\/.+|\//, '');
  }
});
{'fraction_non_alphanumeric': 0.19832109129066108, 'fraction_numerical': 0.0, 'mean_word_length': 3.042372881355932, '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': '3478602', 'n_tokens_mistral': 293, 'n_tokens_neox': 292, 'n_words': 60}