Commit d3a742c3 authored by The Heavy's avatar The Heavy 🚂
Browse files

Prioritise 'not http' over 'src too long' so we can quietly ignore already...

Prioritise 'not http' over 'src too long' so we can quietly ignore already replaced urls as intented.
parent 749acabd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -117,15 +117,15 @@ if __name__ == '__main__':
                if len(url) < 5:
                    log.warning('src attribute not long enough: {0}'.format(document[img_tag - 4:img_end_tag + 40]))
                    continue
                if len(url) > args.maxlen:
                    log.warning('src attribute too long (use -m if required): {0}'.format(document[img_tag - 4:img_tag + args.maxlen]))
                    continue
                if url[:4] != 'http':
                    if url[:len(dest_folder.name)] == dest_folder.name or url[:11] == 'data:image/':
                        log.debug('Quietly ignore already replaced tags.')
                    else:
                        log.warning('src attribute not http: {0}'.format(document[img_tag - 4:img_end_tag + 40]))
                    continue
                if len(url) > args.maxlen:
                    log.warning('src attribute too long (use -m if required): {0}'.format(document[img_tag - 4:img_tag + args.maxlen]))
                    continue
                if '.' not in url:
                    log.warning('Invalid URL, no dots (.) found: {0}'.format(document[img_tag - 4:img_end_tag + 40]))
                    continue