зеркало из https://github.com/mozilla/FlightDeck.git
Merge branch 'bug-666837-add_+_symbol_to_modules'
This commit is contained in:
Коммит
174a210ebb
|
@ -83,6 +83,9 @@ TYPE_CHOICES = (
|
|||
)
|
||||
|
||||
|
||||
FILENAME_RE = r'[^a-zA-Z0-9=!@#\$%\^&\(\)\+\-_\/\.]+'
|
||||
|
||||
|
||||
class PackageRevision(BaseModel):
|
||||
"""
|
||||
contains data which may be changed and rolled back
|
||||
|
@ -1934,7 +1937,7 @@ class Module(BaseModel):
|
|||
self.filename = self.filename[:first_period]
|
||||
|
||||
# remove illegal characters from filename
|
||||
self.filename = re.sub('[^a-zA-Z0-9=!@#\$%\^&\(\)\+\-_\/\.]+', '-',
|
||||
self.filename = re.sub(FILENAME_RE, '-',
|
||||
self.filename)
|
||||
self.filename = re.sub('\/{2,}', '/', self.filename)
|
||||
self.filename = re.sub('^\/', '', self.filename)
|
||||
|
@ -2095,7 +2098,7 @@ class Attachment(BaseModel):
|
|||
return self
|
||||
|
||||
def clean(self):
|
||||
self.filename = pathify(self.filename)
|
||||
self.filename = re.sub(FILENAME_RE, '-', self.filename)
|
||||
if self.ext:
|
||||
self.ext = alphanum(self.ext)
|
||||
|
||||
|
|
|
@ -408,12 +408,12 @@ class TestViews(TestCase):
|
|||
|
||||
revision = self.add_one(filename='^you*()"[]"are-_crazy')
|
||||
att = revision.attachments.all()[0]
|
||||
eq_(att.filename, '-you-are-_crazy')
|
||||
eq_(att.filename, '^you-()-are-_crazy')
|
||||
revision.attachment_remove(att)
|
||||
|
||||
revision = self.add_one(filename='"><a href="">test')
|
||||
att = revision.attachments.all()[0]
|
||||
eq_(att.filename, '-a-href-test')
|
||||
eq_(att.filename, '-a-href=-test')
|
||||
revision.attachment_remove(att)
|
||||
|
||||
revision = self.add_one(filename='template.html.js')
|
||||
|
@ -433,6 +433,11 @@ class TestViews(TestCase):
|
|||
eq_(att.ext, 'ahref')
|
||||
revision.attachment_remove(att)
|
||||
|
||||
revision = self.add_one(filename='data+test.js')
|
||||
att = revision.attachments.all()[0]
|
||||
eq_(att.filename, 'data+test')
|
||||
revision.attachment_remove(att)
|
||||
|
||||
def get_revision_from_response(self, response):
|
||||
return self.package.revisions.filter(
|
||||
revision_number=response['revision_number']).get()
|
||||
|
|
|
@ -453,7 +453,7 @@ var Sidebar = new Class({
|
|||
|
||||
// remove janky characters from filenames
|
||||
// (from promptAttachment)
|
||||
filename = filename.replace(/[^a-zA-Z0-9\-_\/\.]+/g, '-');
|
||||
filename = filename.replace(/[^a-zA-Z0-9=!@#\$%\^&\(\)\+\-_\/\.]+/g, '-');
|
||||
filename = filename.replace(/\/{2,}/g, '/');
|
||||
|
||||
if (filename[filename.length-1] == '/') {
|
||||
|
|
Загрузка…
Ссылка в новой задаче